From 748d5eb0bd71256086f349d5bd86ff96012109de Mon Sep 17 00:00:00 2001 From: Mathias Date: Wed, 3 Jun 2026 19:26:43 +0200 Subject: [PATCH] =?UTF-8?q?feat(store):=20migration=20006=20=E2=80=94=20pe?= =?UTF-8?q?r-user=20auto=5Fsummarize=20+=20per-video=20summarize=5Frequest?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the schema for the summarization-mode feature: a per-user auto/manual toggle (users.auto_summarize, default FALSE = manual) and a per-video manual queue flag (videos.summarize_requested, default FALSE). Both columns land on tables that already have ENABLE + FORCE ROW LEVEL SECURITY (migration 003), so they inherit per-user isolation automatically — no policy changes needed. auto_summarize is per-user, not global, per ADR-012. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../migrations/006_summarization_mode.down.sql | 2 ++ .../migrations/006_summarization_mode.up.sql | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 internal/adapters/store/migrations/006_summarization_mode.down.sql create mode 100644 internal/adapters/store/migrations/006_summarization_mode.up.sql 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;