Mara Rafferty asked
dstala replied
You can rename m2m tables.
- Open project
- Click on user icon > Themes
- Enable “Show M2M Tables”
- Hard refresh, (cmd+shift+r on mac) if additional tables are not displayed by default on project tree
dstala replied
You can then rename table or column name like any other table.
This will only change table/ column name alias for display on NocoDB UI. Right now, we do not have a mechanism to choose custom names in backend tables.
dstala replied
Q2: Is there any way that I can tell NocoDB about this relationship, and it can understand it and treat it the same way as if I’d made the tables through Nocodb? Alternatively, am I simply missing something, and I can make use of this functionality as-is? For example, how could I set up a sheet (view?) where a user could add and remove territories to an employee?
dstala replied
NocoDB infers relationship if you are connecting to external DBs. Additional relations can be created as you wish.
You can refer to following documentation section to create new links to existing tables
https://docs.nocodb.com/setup-and-usages/link-to-another-record
Subsequently, you can lookup/rollup to make more meaningful references to foreign tables
https://docs.nocodb.com/setup-and-usages/lookup
https://docs.nocodb.com/setup-and-usages/rollup
dstala replied
Q3: Suppose I have a relationship between two tables, as described in part 1.c. Can I edit the parameters of those relationships? Do I have to delete the relationship (and the ensuing data) and start again from scratch if I want to change the parameters, like the on delete behaviour?
You can reconfigure such relations from the backend utility like TablePlus or PGAdmin & then sync NocoDB
https://docs.nocodb.com/setup-and-usages/sync-schema
Such changes will be accounted as relation delete & create by NocoDB.
Mara Rafferty replied
Thanks so much for the quick and informative responses! Really appreciate it. Re Q1 and Q3, I think that explains it well.
Mara Rafferty replied
Re Q2, I’m still not understanding exactly. In my database (northwind), I have an m2m table called employee_territories with FK relationships to employees and territories.
It’s not clear to me how I can add a column to Employees showing the name of the territories they are associated with. Lookup dosn’t work, and LinkToAnotherRecord seems like it would create a new relationship on top of the existing one. When I try creating a new record link, if I try “has many” it tells me “relation update successful” and creates a new relation table in the db, in addition to the employee_territories one that already exists. But even with this, nothing changes in the UI and there’s no way to get the column with data I need. Am I missing something?
Mara Rafferty replied
Oh, and while we are on the topic (if you don’t mind), I had one more question, related to all of this. (Q4). Can relations only show Primary Keys?
Imagine if, in the case I asked about in Q1, we add another column in Territories, Abbreviation.
Would it ever be possible to select which field from Territories I’m going to show in the Users table in my linked field? Could I have different columns in the user tables show different fields from Territories? Happy to elaborate more if it’s helpful.
dstala replied
Q2: Adding a record, please see if the workflow captured here helps
Workflow with Launchnotes and localhost
Mara Rafferty replied
Thanks dstala@discord ! I really appreciate it. I think maybe my question wasn’t exactly clear. I was wondering how/if I can switch between displaying the Territory Name, versus the Territory Abbreviation, in the Users table.
dstala replied
To use a different field, you will have to set it as ‘Primary value’
Click on drop down menu for the column you wish to reconfigure, and select it as ‘Primary Value’
Mara Rafferty replied
Perf. Is it on the roadmap / horizon / is it a feature I can request (and eventually possibly help with) to enable a select of a different (non PK) column from a linked table? (And if we went down that road, maybe be able to add some more complex criteria like WHERE clauses, etc.)
dstala replied