hyperzone
hyperzone11mo ago

Deleting an image when deleting an item

Say I have this part in the schema(using ents):
items: defineEnt({
name: v.string(),
description: v.string(),
image: v.id("_storage"),
})
items: defineEnt({
name: v.string(),
description: v.string(),
image: v.id("_storage"),
})
do I have to delete the image "manually" using
ctx.storage.delete(storageId);
ctx.storage.delete(storageId);
or is there a way to make it happen automatically when an item gets deleted?
1 Reply
Michal Srb
Michal Srb11mo ago
Yes, this is probably the most request feature atm: https://github.com/xixixao/convex-ents/issues/18
GitHub
Allow owning files in storage and deleting them via cascading delet...
Suggested on Discord: https://discord.com/channels/1019350475847499849/1202403482930249789/1202795277132759131 This is tricky because: The ID of the "owning" ent cannot be stored in _stor...

Did you find this page helpful?