Files
tapir/internal/adapters/store/migrations/006_summarization_mode.up.sql
T
mathiasandClaude Opus 4.8 748d5eb0bd feat(store): migration 006 — per-user auto_summarize + per-video summarize_requested
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) <noreply@anthropic.com>
2026-06-03 19:26:43 +02:00

18 lines
1.1 KiB
SQL

-- 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;