fix: make agent schedule migration idempotent for production
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m1s

Use DO blocks with EXCEPTION WHEN duplicate_column to safely handle
columns that may already exist from a previous db push.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 11:35:50 +02:00
parent 102ccd13d4
commit 9e9e17ed96

View File

@@ -1,4 +1,15 @@
-- AlterTable: Agent
ALTER TABLE "Agent" ADD COLUMN "scheduledTime" TEXT DEFAULT '08:00';
ALTER TABLE "Agent" ADD COLUMN "scheduledDay" INTEGER;
ALTER TABLE "Agent" ADD COLUMN "timezone" TEXT;
-- AlterTable: Agent (idempotent — safe if columns already exist from a previous db push)
DO $$ BEGIN
ALTER TABLE "Agent" ADD COLUMN "scheduledTime" TEXT DEFAULT '08:00';
EXCEPTION WHEN duplicate_column THEN NULL;
END $$;
DO $$ BEGIN
ALTER TABLE "Agent" ADD COLUMN "scheduledDay" INTEGER;
EXCEPTION WHEN duplicate_column THEN NULL;
END $$;
DO $$ BEGIN
ALTER TABLE "Agent" ADD COLUMN "timezone" TEXT;
EXCEPTION WHEN duplicate_column THEN NULL;
END $$;