How do I define a composite foreign key?

Similar to this syntax in prisma?
%field% %Type% @relation(fields: [id, objectType], references: [objectId, objectType])
%field% %Type% @relation(fields: [id, objectType], references: [objectId, objectType])
I saw the section about composite primary keys but I didn't find anything about composite foreign keys. Thank you in advance
5 Replies
Andrii Sherman
Andrii Sherman17mo ago
we have a docs section for it and if you want to have composite FK just scroll down a bot in a link I've sent
Andrii Sherman
Andrii Sherman17mo ago
Andrii Sherman
Andrii Sherman17mo ago
The example is not a realworld case, but it shows how syntax looks like
FullSendShen
FullSendShen12mo ago
Can that composite foreign key also be the primary key? @Andrew Sherman
Want results from more Discord servers?
Add your server