Diagnostics: detecting @unique constraint on foreign-key in one-to-many relationships #1355
Labels
domain/schema
Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc.
kind/improvement
An improvement to existing feature and code.
topic: diagnostics
topic: relation
topic: validation
Suggested solution
Inform user when @unique constraint is used on foreign key.
Additional context
I believe that using @unique key in described scenario is unwanted behavior. In the example below setting @unique field on authorId field makes it impossible for User to have multiple Posts.
Diagnostic should detect this just as it is detects when @unique is not set on foreign key in one-to-one relationship.
The text was updated successfully, but these errors were encountered: