20220924000853_propagate-delete-assets.sql 458 B

12345678910111213
  1. -- Adds a delete trigger to both media_posters and media_backdrops which
  2. -- ensure that the asset erased is also deleted from the assets table
  3. CREATE TRIGGER IF NOT EXISTS media_backdrops_propagate
  4. AFTER DELETE ON media_backdrops
  5. FOR EACH ROW BEGIN
  6. DELETE FROM assets WHERE id = old.asset_id;
  7. END;
  8. CREATE TRIGGER IF NOT EXISTS media_posters_propagate
  9. AFTER DELETE ON media_posters
  10. FOR EACH ROW BEGIN
  11. DELETE FROM assets WHERE id = old.asset_id;
  12. END;