fix(db): target the users table in the v1.22 AI-settings migration

The AI-settings migration altered "User" but the table is "users"; deploy
would abort with relation "User" does not exist. Correct the identifier and
make both v1.22 column additions rerun-safe with IF NOT EXISTS.
This commit is contained in:
Marc-André Bombeck committed 2026-06-27 15:46:03 +02:00
1 parent b900732802
commit ee4fa55c1e
2 files changed
+8 -8

No files matched your search

@@ -3,4 +3,4 @@
-- processed, the grounded before/after result is written here. Additive,
-- nullable Bytes column — no backfill, no enum change (the new statuses
-- review_due / reviewed are app-side strings on the existing `status` column).
ALTER TABLE "coach_plans" ADD COLUMN "outcome_encrypted" BYTEA;
ALTER TABLE "coach_plans" ADD COLUMN IF NOT EXISTS "outcome_encrypted" BYTEA;
@@ -17,10 +17,10 @@
-- encrypted-columns registry + the rotation script).
--
-- All columns are nullable / defaulted, so existing rows need no backfill.
ALTER TABLE "User"
ADD COLUMN "ai_response_timeout_seconds" INTEGER,
ADD COLUMN "ai_ocr_enabled" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "ai_ocr_provider" TEXT,
ADD COLUMN "ai_ocr_model" TEXT,
ADD COLUMN "ai_ocr_base_url" TEXT,
ADD COLUMN "ai_ocr_key_encrypted" TEXT;
ALTER TABLE "users"
ADD COLUMN IF NOT EXISTS "ai_response_timeout_seconds" INTEGER,
ADD COLUMN IF NOT EXISTS "ai_ocr_enabled" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN IF NOT EXISTS "ai_ocr_provider" TEXT,
ADD COLUMN IF NOT EXISTS "ai_ocr_model" TEXT,
ADD COLUMN IF NOT EXISTS "ai_ocr_base_url" TEXT,
ADD COLUMN IF NOT EXISTS "ai_ocr_key_encrypted" TEXT;