Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error when disconnecting a self-relation #1530

Open
ymc9 opened this issue Jun 22, 2024 · 0 comments
Open

Runtime error when disconnecting a self-relation #1530

ymc9 opened this issue Jun 22, 2024 · 0 comments
Milestone

Comments

@ymc9
Copy link
Member

ymc9 commented Jun 22, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant