From 1b8714b0f6187efae995bf0871f3d017b9d56eb4 Mon Sep 17 00:00:00 2001 From: Sleeps Date: Thu, 8 Oct 2026 16:17:09 +0100 Subject: [PATCH] Add backwards-compatible specialist overview style metadata --- scene_search/database.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scene_search/database.py b/scene_search/database.py index 8468f81..45e2d44 100644 --- a/scene_search/database.py +++ b/scene_search/database.py @@ -104,6 +104,7 @@ CREATE TABLE IF NOT EXISTS jellyfin_overview_drafts ( jellyfin_item_id TEXT NOT NULL, overview TEXT NOT NULL, model TEXT NOT NULL, + style TEXT NOT NULL DEFAULT 'general', caption_fingerprint TEXT NOT NULL, sampled_captions INTEGER NOT NULL, original_overview TEXT, @@ -179,11 +180,25 @@ def _ensure_frame_caption_columns(con: sqlite3.Connection) -> None: ) +def _ensure_overview_columns(con: sqlite3.Connection) -> None: + """Upgrade existing overview drafts without dropping publish/restore backups.""" + columns = { + row["name"] + for row in con.execute("PRAGMA table_info(jellyfin_overview_drafts)") + } + if "style" not in columns: + con.execute( + "ALTER TABLE jellyfin_overview_drafts " + "ADD COLUMN style TEXT NOT NULL DEFAULT 'general'" + ) + + def init_db(path: Path) -> None: with connect(path) as con: con.executescript(SCHEMA) _ensure_media_jellyfin_columns(con) _ensure_frame_caption_columns(con) + _ensure_overview_columns(con) def pack_vector(vector: np.ndarray) -> bytes: