<@U0RQY0KK5> <@U8L2D9TMJ> Here are the relevant co...
# orm-help
p
@nilan @harmony Here are the relevant contents of my data model concerning our threat https://graphcool.slack.com/archives/C0MQJ62NL/p1523226450000010 :
Copy code
type List  {
  id: ID! @unique
  listEntries: [ListEntry!]! @relation(name: "ListentriesOnLists", cascadeDelete: true)
  name: String!
  site: Site
  toDelete: Boolean! @default(value: false)
}

type ListEntry  {
  createdAt: DateTime!
  updatedAt: DateTime!
  description: String @default(value: "")
  id: ID! @unique
  isCompleted: Boolean! @default(value: false)
  list: List! @relation(name: "ListentriesOnLists", cascadeDelete: false)
  position: Int! @default(value: 1)
  starred: Boolean! @default(value: false)
  task: String!
  person: Person
  category: Category
}
And the resolver:
Copy code
deleteList(parent, { id }, ctx, info) {
      return ctx.db.mutation.deleteList({ where: { id } }, info)
    },
... in schema.graphql:
Copy code
deleteList(id: ID!): List
When I try to delete a list without any entry, it works, but if the list has subentries, I get the following error:
Copy code
Uncaught (in promise) Error: GraphQL error: The change you are trying to make would violate the required relation '_ListentriesOnLists' between List and ListEntry
n
This looks like a bug, can you please provide a bug report here: https://github.com/graphcool/prisma? 🙂
h
shouldn't it be
onDelete="CASCADE"
?
*
onDelete: CASCADE
💯 1
put that on list and delete the thing in
ListEntry
n
ah right
p
@harmony Thank you very much, that worked like a charme! 😄 Was
cascadeDelete: true
an earlier syntax, or was it just the syntax from the proposal? I definitively read that syntax somewhere. I haven't made it up...
h
not sure