From 2ed3d3373af44aa9cc4a4125234e2456b45c72e1 Mon Sep 17 00:00:00 2001 From: Kayos Date: Wed, 13 May 2026 20:28:59 -0700 Subject: [PATCH] migration 0006: extend generation_runs.kind to allow narrate_prep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migration 0005 added the chapters.body_md_tts column but missed this check constraint update — caught at runtime when prepare-narration tried to insert kind='narrate_prep'. Postgres doesn't ALTER CHECK in place; we drop + re-add. --- migrations/0005_chapter_body_md_tts.sql | 3 --- migrations/0006_generation_runs_narrate_prep.sql | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 migrations/0006_generation_runs_narrate_prep.sql diff --git a/migrations/0005_chapter_body_md_tts.sql b/migrations/0005_chapter_body_md_tts.sql index cb69956..c0c608d 100644 --- a/migrations/0005_chapter_body_md_tts.sql +++ b/migrations/0005_chapter_body_md_tts.sql @@ -10,6 +10,3 @@ -- whenever the author's beat-placement taste shifts. ALTER TABLE chapters ADD COLUMN body_md_tts text; - --- generation_runs.kind already accepts any string; no check --- constraint to update. The new pass kind is 'narrate_prep'. diff --git a/migrations/0006_generation_runs_narrate_prep.sql b/migrations/0006_generation_runs_narrate_prep.sql new file mode 100644 index 0000000..025b87f --- /dev/null +++ b/migrations/0006_generation_runs_narrate_prep.sql @@ -0,0 +1,9 @@ +-- Extend generation_runs.kind to allow the new narrate_prep pass. +-- (Migration 0005 added body_md_tts but missed the check constraint.) +-- Postgres doesn't support altering a check constraint in place, +-- so we drop + re-add. +ALTER TABLE generation_runs + DROP CONSTRAINT generation_runs_kind_check; +ALTER TABLE generation_runs + ADD CONSTRAINT generation_runs_kind_check + CHECK (kind = ANY (ARRAY['gen', 'cleanup', 'audit', 'summary', 'embed', 'narrate_prep']));