Cascade onDelete when not using FK relations

Is there a way to add a cascade on delete when declaring relations without FK ? For planetscale for example ?
6 Replies
rphlmr ⚡
rphlmr ⚡17mo ago
For Planetscale I found this discussion: https://github.com/planetscale/discussion/discussions/74
GitHub
How do I maintain referential integrity? · planetscale discussion ·...
There are no foreign keys, so how do I relate data: Without duplicating data Making sure that every reference still exists Etc What is the alternative for there being no foreign keys?
Elv
ElvOP17mo ago
Thanks very useful!
Angelelz
Angelelz17mo ago
That's actually why I don't like planetscale. I love me some referential integrity. The answer just dismisses on delete cascade like nobody should do it. But what if that's actually the behavior I need in my application. I want Sql to handle the case where I want to delete an user and everything that has to do with it. I don't want to think about it.
Dellgenius
Dellgenius16mo ago
so if we're using planetscale, the only option we have is to manually retrieve everything and delete it? (i.e. if we would like to delete a user, we have to manually retrieve all blog posts, all comments for the post, and delete them all?)
shikishikichangchang
looks like they announced support for this
Want results from more Discord servers?
Add your server