How to delete nodes with relations? <http://prntsc...
# prisma-whats-new
v
How to delete nodes with relations? http://prntscr.com/io20nu How to do it right ?
m
either remove the mandatory nature of the relation or delete the related node first
If you're using Prisma you can cascade your deletes
@Vendicto
v
I don't use Prisma
so first I must delete Tag model, and after delete Post, am I right ?
@max
m
@Vendicto yes you could delete the tag first then post. or you could remove the
!
from
post: Post!
in your Tag model
v
thanks I will try
This is complicate. because Tags is required, and one post can have more than 3 tags, so I must delete each tag for this post, and after that I can delete post ?
how to delete all tags by one request ? @max
m
are you using graphcool-framework? you could create a resolver to deletePost. It would fetch the tag ids and delete them first and then deletePost
@Vendicto
v
hmm ok
thanks a lot !