我试图在 Prisma ORM 的一个模型中建立两个 1:1 关系,但出现以下错误:
验证模型“人”时出错:检测到不明确的关系。字段
placeOfBirth
和placeOfDeath
模型中Person
均指Place
. 请通过添加为它们提供不同的关系名称@relation(<name>)
。
我的棱镜架构:
model Place {
id Int @id @default(autoincrement())
name String
persons Person[]
}
model Person {
id Int @id @default(autoincrement())
name String
placeOfBirthId Int
placeOfDeathId Int
placeOfBirth Place @relation(fields: [placeOfBirthId], references: [id])
placeOfDeath Place @relation(fields: [placeOfDeathId], references: [id])
}
完全不明白。