Files
Momento/memento-note/prisma/migrations/20260426130000_add_agent_schedule_fields/migration.sql
sepehr 9e9e17ed96
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m1s
fix: make agent schedule migration idempotent for production
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>
2026-04-26 11:35:50 +02:00

16 lines
461 B
SQL

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