我试图在 Prisma ORM 的一个模型中建立两个 1:1 关系,但出现以下错误:
验证模型“Person”时出错:检测到不明确的关系。模型中的字段
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])
}
Run Code Online (Sandbox Code Playgroud)
完全不明白。