By default Prisma names the many to many tables as follow : "_" name of Table A "to" name of Table B ( witch would give the name _TableaToTableb )
The name of the id fields inside those tables are "A" and "B" by default
Here are my two questions :
- is it possible to manually name the relation tables and the fields ?
I did not find any reference in the documentation about it but I am not yet very familiar with it yet ( checked here ) - Is it a good idea to manually set the name of the relations ?
Apart from the very obvious issue of having possible name conflicts when doing so is there possible issues I am not foreseeing when wanting to set the names myself ? ( harder to query ? harder to use ? ... )
The current stack is NextJs / postgreSQL / Prisma if it makes any difference
CodePudding user response:
No it's not possible to manually name the relation tables and fields.
Why would you want to directly query the relation table? If you need extra metadata to be stored in the relation table, best to create an implicit many-to-many relation.