From 07d1fc9e72b1a6492145c337d776dc0ed421e967 Mon Sep 17 00:00:00 2001 From: Wild Dragon Dev Date: Wed, 3 Jun 2026 16:54:35 +0000 Subject: [PATCH] fix(scheduler): allow 'starting' and 'stopping' statuses in DB The scheduler tick loop updates a schedule's status to 'starting' and 'stopping' in the database while it initiates the API calls to the recorder container. The original CHECK constraint in recorder_schedules rejected these two statuses, causing the scheduler to crash on constraint violation and never start the job. --- .../db/migrations/035-alter-schedule-status-constraint.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 services/mam-api/src/db/migrations/035-alter-schedule-status-constraint.sql diff --git a/services/mam-api/src/db/migrations/035-alter-schedule-status-constraint.sql b/services/mam-api/src/db/migrations/035-alter-schedule-status-constraint.sql new file mode 100644 index 0000000..8ffdf07 --- /dev/null +++ b/services/mam-api/src/db/migrations/035-alter-schedule-status-constraint.sql @@ -0,0 +1,7 @@ +-- Add 'starting' and 'stopping' to recorder_schedules status check constraint + +ALTER TABLE recorder_schedules DROP CONSTRAINT recorder_schedules_status_check; + +ALTER TABLE recorder_schedules + ADD CONSTRAINT recorder_schedules_status_check + CHECK (status IN ('pending','running','completed','failed','cancelled','starting','stopping'));