20220512210542_master-changes.sql 794 B

1234567891011121314151617181920212223242526
  1. DROP INDEX media_excl_ep_idx;
  2. -- Recreate media view
  3. DROP VIEW media;
  4. CREATE VIEW media AS
  5. SELECT _tblmedia.*, pp.local_path as poster_path, bp.local_path as backdrop_path
  6. FROM _tblmedia
  7. LEFT OUTER JOIN assets pp ON _tblmedia.poster = pp.id
  8. LEFT OUTER JOIN assets bp ON _tblmedia.backdrop = bp.id;
  9. CREATE TRIGGER media_delete
  10. INSTEAD OF DELETE ON media
  11. BEGIN DELETE FROM _tblmedia WHERE _tblmedia.id = old.id; END;
  12. -- Recreate season view
  13. DROP VIEW season;
  14. CREATE VIEW season AS
  15. SELECT _tblseason.id, _tblseason.season_number, _tblseason.tvshowid, _tblseason.added, assets.local_path as poster
  16. FROM _tblseason
  17. LEFT OUTER JOIN assets ON _tblseason.poster = assets.id;
  18. CREATE TRIGGER season_delete
  19. INSTEAD OF DELETE ON season
  20. BEGIN DELETE FROM _tblseason WHERE _tblseason.id = old.id; END;