P
Prisma8mo ago
tzezar

MTI key relation

model Supertype {
id Int @id @default(autoincrement())
Subtype Subtype[]
}

model Subtype {
id Int @id
supertype Supertype @relation(fields: [id], references: [id])
}
model Supertype {
id Int @id @default(autoincrement())
Subtype Subtype[]
}

model Subtype {
id Int @id
supertype Supertype @relation(fields: [id], references: [id])
}
Is this valid code to describe foreign keys between two entities?
Solution:
Hi :vmathi: This looks correct to me. Did you get any issue with it?
Jump to solution
2 Replies
Solution
Olyno
Olyno8mo ago
Hi :vmathi: This looks correct to me. Did you get any issue with it?
tzezar
tzezarOP8mo ago
Thanks for the answer. Everything is working, but this is just the first time I am using prisma and at first I had trouble reflecting logical reprenstation in prisma schema language, so to speak. I couldn't find a similar topic on the web so I asked a question to make sure I had figured it out correctly.
Want results from more Discord servers?
Add your server