prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

I think onDelete: CASCADE not working!

Open colevels opened this issue 8 years ago • 3 comments

When I delete a blog, comments in a blog not deleted. I removed ! at User on blog and Blog on the comment because it's error. #1795

type User {
  id: ID! @unique
  comments: [Comment!]! @relation(name: "CommentAuthor", onDelete: CASCADE)
  blog: Blog @relation(name: "BlogOwner", onDelete: CASCADE)
}

type Blog {
  id: ID! @unique
  comments: [Comment!]! @relation(name: "Comments", onDelete: CASCADE)
  owner: User @relation(name: "BlogOwner", onDelete: SET_NULL)
}

type Comment {
  id: ID! @unique
  blog: Blog @relation(name: "Comments", onDelete: NO_ACTION)
  author: User @relation(name: "CommentAuthor", onDelete: NO_ACTION)
}

colevels avatar Feb 09 '18 02:02 colevels

https://github.com/graphcool/prisma/pull/1825 WIP now

oxy88 avatar Feb 09 '18 05:02 oxy88

Check #1262

emipc avatar Feb 09 '18 18:02 emipc

This is now available on the unstable channel, please refer to the two mentioned links by @oxy88 and @emipc for more information 🙂

marktani avatar Feb 09 '18 18:02 marktani