diff --git a/scene_search/database.py b/scene_search/database.py index 32fa9cb..8468f81 100644 --- a/scene_search/database.py +++ b/scene_search/database.py @@ -97,7 +97,10 @@ CREATE INDEX IF NOT EXISTS idx_caption_windows_unsynced WHERE caption IS NOT NULL; CREATE TABLE IF NOT EXISTS jellyfin_overview_drafts ( - media_id TEXT PRIMARY KEY REFERENCES media(id) ON DELETE CASCADE, + -- Do NOT cascade on media deletion: the indexing code temporarily deletes + -- and recreates the media row when an ETag changes, including after metadata + -- edits. Original Overview backups must survive that reindex lifecycle. + media_id TEXT PRIMARY KEY, jellyfin_item_id TEXT NOT NULL, overview TEXT NOT NULL, model TEXT NOT NULL,