diff --git a/internal/adapters/store/migrations/006_summarization_mode.down.sql b/internal/adapters/store/migrations/006_summarization_mode.down.sql new file mode 100644 index 0000000..6c1495f --- /dev/null +++ b/internal/adapters/store/migrations/006_summarization_mode.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE videos DROP COLUMN IF EXISTS summarize_requested; +ALTER TABLE users DROP COLUMN IF EXISTS auto_summarize; diff --git a/internal/adapters/store/migrations/006_summarization_mode.up.sql b/internal/adapters/store/migrations/006_summarization_mode.up.sql new file mode 100644 index 0000000..395d2a6 --- /dev/null +++ b/internal/adapters/store/migrations/006_summarization_mode.up.sql @@ -0,0 +1,17 @@ +-- Migration 006: summarization mode (per-user auto/manual + per-video queue). +-- +-- auto_summarize is a per-user setting (not a global one): multi-user ready per +-- ADR-012. FALSE default makes MANUAL the out-of-the-box behavior — `tapir run` +-- discovers new videos but only summarizes the ones the user explicitly queued. +-- +-- summarize_requested is the per-video manual queue flag. The web "Summarize" +-- button sets it TRUE; the next `tapir run` picks it up, summarizes, and clears +-- it back to FALSE. In auto mode it is unused. +-- +-- No RLS policy changes needed: both columns are added to tables that already +-- carry user_id and have ENABLE + FORCE ROW LEVEL SECURITY (migration 003). A new +-- column on an RLS-protected table inherits that protection automatically — the +-- existing users_isolation / videos_isolation policies gate every row, so these +-- columns are only ever readable/writable for the row's own user. +ALTER TABLE users ADD COLUMN auto_summarize BOOLEAN NOT NULL DEFAULT FALSE; +ALTER TABLE videos ADD COLUMN summarize_requested BOOLEAN NOT NULL DEFAULT FALSE;