One-to-one relation requires one side of reference to be marked @unique. It's not checked today.
repro:
model User {
id String @id @default(cuid())
data UserData?
}
model UserData {
id String @id @default(cuid())
user User @relation(fields: [userId], references: [id])
userId String
}
Error:
Error parsing attribute "@relation": A one-to-one relation must use unique fields on the defining side. Either add an @unique attribute to the field userId, or change the relation to one-to-many.
One-to-one relation requires one side of reference to be marked @unique. It's not checked today.
repro:
Error:
Error parsing attribute "@relation": A one-to-one relation must use unique fields on the defining side. Either add an
@uniqueattribute to the fielduserId, or change the relation to one-to-many.