Prisma, self relation onDelete, onUpdate behavior

I have a prisma model:
model Comment {
    ...
    children Comment[] @relation("replies")
    parent   Comment?  @relation("replies", fields: [parentId], references: [id])
    parentId String?
}


I want to add onDelete: Cascade or onUpdate: Cascade, but it returns an error:
Error validating: A self-relation must have onDelete and onUpdate referential actions set to NoAction in one of the @relation attributes. (Implicit default onDelete: SetNull, and onUpdate: Cascade) Read more at https://pris.ly/d/cyclic-referential-actions
Prisma
Circular references or multiple cascade paths can cause validation errors on Microsoft SQL Server and MongoDB. Since the database does not handle these situations out of the box, learn how to solve this problem.
Was this page helpful?