From 3059adfd37cf90aec54d0d5cc49e61c1670b1a2e Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 15 Apr 2026 09:28:53 -0400 Subject: [PATCH] Add missing DB migration sql for training data --- .../down.sql | 14 ++++++++++++++ .../up.sql | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 migrations/2026-04-10-000000_add_training_data_to_insights/down.sql create mode 100644 migrations/2026-04-10-000000_add_training_data_to_insights/up.sql diff --git a/migrations/2026-04-10-000000_add_training_data_to_insights/down.sql b/migrations/2026-04-10-000000_add_training_data_to_insights/down.sql new file mode 100644 index 0000000..23ecc9c --- /dev/null +++ b/migrations/2026-04-10-000000_add_training_data_to_insights/down.sql @@ -0,0 +1,14 @@ +-- SQLite doesn't support DROP COLUMN directly, so we recreate the table +CREATE TABLE photo_insights_backup AS SELECT id, file_path, title, summary, generated_at, model_version, is_current FROM photo_insights; +DROP TABLE photo_insights; +CREATE TABLE photo_insights ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + file_path TEXT NOT NULL, + title TEXT NOT NULL, + summary TEXT NOT NULL, + generated_at BIGINT NOT NULL, + model_version TEXT NOT NULL, + is_current BOOLEAN NOT NULL DEFAULT TRUE +); +INSERT INTO photo_insights SELECT * FROM photo_insights_backup; +DROP TABLE photo_insights_backup; diff --git a/migrations/2026-04-10-000000_add_training_data_to_insights/up.sql b/migrations/2026-04-10-000000_add_training_data_to_insights/up.sql new file mode 100644 index 0000000..2931990 --- /dev/null +++ b/migrations/2026-04-10-000000_add_training_data_to_insights/up.sql @@ -0,0 +1,2 @@ +ALTER TABLE photo_insights ADD COLUMN training_messages TEXT; +ALTER TABLE photo_insights ADD COLUMN approved BOOLEAN;