aarku
CCConvex Community
•Created by aarku on 11/15/2024 in #support-community
Guidance on properly cascading deletions
I'm working on converting the Ents SaaS Next.js Starter ( https://www.convex.dev/templates/ents-saas-starter ) away from Ents, because other than Ents it has everything I wanted. To do this I was reading about Ents, and came across this article talking about the challenges of deletion: https://stack.convex.dev/ents#cascading-deletes-soft-deletion-and-scheduled-deletion . It says:
This makes deletion in general more challenging though. You can easily have a scenario where a document’s ID is stored in 1000s or even more other documents. Deleting all of these documents in a single mutation, which is within a single transaction, is simply impossible, as it would require a long-lived transaction, grinding the whole database to a halt (something Convex does not allow, instead failing the mutation).So in conventional Convex, what's the suggested way to cascade a delete? I would prefer my app to not fail at deleting a workspace only when it has a lot of content in it. It'd be great to have an example exactly like the ents-saas-starter that doesn't use Ents, but that may be too much to ask. Thank you, -Jon
3 replies