From 950f024aa9b871a0c437ca992959424d4c66899d Mon Sep 17 00:00:00 2001 From: sepehr Date: Sun, 26 Apr 2026 11:51:43 +0200 Subject: [PATCH] fix: add new migration to ensure agent schedule columns exist Previous migration (20260426130000) may be recorded as failed in _prisma_migrations after a db push conflict. This new migration with a different timestamp will be seen as pending and applied with idempotent SQL that handles both cases. Co-Authored-By: Claude Opus 4.7 --- .../migration.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 memento-note/prisma/migrations/20260426140000_ensure_agent_schedule_columns/migration.sql diff --git a/memento-note/prisma/migrations/20260426140000_ensure_agent_schedule_columns/migration.sql b/memento-note/prisma/migrations/20260426140000_ensure_agent_schedule_columns/migration.sql new file mode 100644 index 0000000..3faa9a9 --- /dev/null +++ b/memento-note/prisma/migrations/20260426140000_ensure_agent_schedule_columns/migration.sql @@ -0,0 +1,16 @@ +-- Ensure agent schedule columns exist (idempotent) +-- Handles both: fresh DB (columns missing) and DB where columns were added by 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 $$;