From 029c895dd39af6b1ed8a3eba1ecf45d6cc403b19 Mon Sep 17 00:00:00 2001 From: Sleeps Date: Thu, 8 Oct 2026 15:49:52 +0100 Subject: [PATCH] Preserve AI overview drafts and original metadata backups across Jellyfin reindex --- scene_search/database.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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,