Prisma3mo ago

why can't all sides of relation become mandatory? why one of the side has to be optional?

Here's the example. input TextInput? inside TextGeneration model can't be mandatory, otherwise it throws "The relation field text_generation on Model TextInput is required. This is no longer valid because it's not possible to enforce this constraint on the database level.". I have read the docs here (https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/one-to-one-relations#mandatory-1-1-relation) but I don't find any reason for why it has to be optional. Wouldn't that mean TextGeneration may not have a TextInput when it is created? For more context, there foreign key has to be in the TextInput because it is the child model.
One-to-one relations | Prisma Documentation
How to define and work with one-to-one relations in Prisma.
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin