You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the @relation part in the .prisma file is changed as follows, a syntax error occurs in @relation in the generated schema.prisma.
sample.prisma
before↓
model Sample {
...
employee Employee @relation(fields: [employee_id], references: [id])
employee_id Int
...
}
after↓
model Sample {
...
employee Employee @relation(fields: [employee_id], references: [id], onDelete: Cascade)
employee_id Int
...
}
schema.prisma
model Employee_Assignment {
...
employee Employee @relation(fields: [employee_id], references: [id]) @relation(fields: [employee_id], references: [id], onDelete: Cascade)
employee_id Int
...
}
Error
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Attribute "@relation" can only be defined once.
--> schema.prisma:103
|
103 | employee Employee @relation(fields: [employee_id], references: [id]) @relation(fields: [employee_id], references: [id], onDelete: Cascade)
|
error: Attribute "@relation" can only be defined once.
--> schema.prisma:103
|
103 | employee Employee @relation(fields: [employee_id], references: [id]) @relation(fields: [employee_id], references: [id], onDelete: Cascade)
|
Validation Error Count: 2
[Context: getDmmf]
The text was updated successfully, but these errors were encountered:
kotaitos
changed the title
If the @relation part in the .prisma file is changed as follows, a syntax error occurs in @relation in the generated schema.prisma.
Problem occurring in @relation part when generating schema.prisma
Jan 13, 2023
If the @relation part in the .prisma file is changed as follows, a syntax error occurs in @relation in the generated schema.prisma.
before↓
after↓
Error
The text was updated successfully, but these errors were encountered: