Runtime error when disconnecting a self-relation
ymc9 opened this issue · comments
model Category {
id Int @id @default(autoincrement())
name String @unique
parentId Int?
parent Category? @relation("ParentChildren", fields: [parentId], references: [id])
children Category[] @relation("ParentChildren")
@@map('categories')
@@allow('all', true)
}
const db = ... // enhanced prisma
db.category.update({
where: {id: 1}, data: { parent: {connect: {id: 1}} }
}) // Works fine to connect
db.category.update({
where: {id: 1}, data: { parent: {disconnect: true} }
}) // Does not work (?) enhance injects parentId in the where