Weak relations
Hi there,
Is there any way to use Prisma relations without any foreign key constraint on Postgre?
I'd like to be able to set this up on a per table basis and not for the whole database like
relationMode = "prisma"
would do.
I've been looking online for this and it appears to be a feature that has been requested a couple years ago already. What's the status on this?
Cheers4 Replies
Manage relations between records with relation modes in Prisma | Pr...
Manage relations between records with relation modes in Prisma
When you use the relation mode, Prisma will not create foreign key constraints in the database. Relations are emulated by Prisma ORM using additional database queries and logic to maintain referential integrity
Thank you for your answer 🙂
I just edited my question because it didn't give enough details about my usecase. Do you know its possible to define the relation mode only for a set of tables?
It is not ot possible to define the relation mode only for a specific set of tables. The relation mode is set globally. We have an open issue for supporting weak relations. You may also want to take a look at this Github Discussion.
GitHub
Support (some) weak relations with no foreign key · Issue #7351 · p...
Problem I need a relation in my schema so that I can query across two tables, but without the referential integrity constraints that come with a foreign key. This is related to issue #7293, but dif...