<@U0RQY0KK5> How, can I handle a deleteMany for re...
# prisma-whats-new
p
@nilan How, can I handle a deleteMany for related nodes in Prisma? I have a List node and ListEntry node. The relation between those two is obvious. Now I need to delete all ListEntries, related to List, when List is deleted. 'cascadeDelete' doesn't work for obvious reasons.
h
well cascade will work if you just delete one list
n
'cascadeDelete' doesn't work for obvious reasons.
what are those obvious reasons?
p
@nilan I thought this falls under the case deleteMany. I thought your comment to the issue https://github.com/graphcool/prisma/issues/2103 would apply here. That's the reason I wrote "obviously". Well I get the following error anyways: "Error: The change you are trying to make would violate the required relation"
n
are you using the
deleteMany
mutation?
did you set up cascading delete on the relation in your data model?
p
@nilan I'm using the standard mutation deleteList in my resolver. And cascading delete was set to true on the side of the ListEntries.
n
Please share the relevant part of the data model
also, my comment you refer to is about
deleteMany
mutations only.
p
I will, but I'm currently at work and my model is on my private computer. So I will have to wait until later. But I will absolutely do so. Thank you! 🙂 Sorry about my confusion concerning the different mutation types etc. I switched from GraphCool BaaS to GraphQL trough a self written apollo server and now I'm using Prisma. Given the fact, that I'm pretty new to the whole GraphQl world in total, I tend to misunderstand or misinterpret certain concepts. Thank you again for your help @nilan 🙂. I will post my model later today.
n
No big deal 🙂 Happy to help!
Looking forward to more information, so I can look into what is happening. It's either a usage problem, or a bug.
h
you want cascade delete on list -> listEntries
not listEntries -> list
p
@nilan I will put my model in here later, when I have my local dev system back up running. I'm currently encountering a docker error, I'm not able to resolve.