I have this model defined: ``` type Post { id: ...
# orm-help
s
I have this model defined:
Copy code
type Post {
  id: ID! @unique
  text: String!
  parent: Post @relation(name: "PostParent", onDelete: SET_NULL)
  children: [Post!]! @relation(name: "PostParent", onDelete: CASCADE)
  author: User! @relation(name: "UserPosts", onDelete: SET_NULL)
}
If a post is deleted, I want all of its children to be deleted as well. However, I get this error:
Copy code
There was a loop in the path generated by the onDelete: Cascade directives on your schema when trying to do the delete.
Any thoughts on how to achieve the desired effect?
j
You figure it out? Trying to figure out how to model my nested fields.
s
I am going to try just flipping the onDelete value for
parent
and
children
. Logically (based on their documentation) that probably won't work, but I don't see any other option.
I'll let you know
I get the same error @Jscott388
n