how to delete the references in other tables to a deleted item?
If i delete a
quoteItem
, how can i delete also the other tables that are referencing this item ?
2 Replies
db.query
for the documents that need deleting, then you can loop over them with db.delete
This way you can be very explicit about how the deletion "cascades" through your database.
For a more automated approach you could use Ents: https://labs.convex.dev/convex-ents/schema/deletesCascading Deletes - Convex Ents
Relations, default values, unique fields and more for Convex
so i would have to add an index to the other tables to find the ones referencing to the deleted item to be able to delete those references?
Ents would be ideal but i'm migrating two projects that are already in production and i dont have the bandwidth to use a beta library in these projects