chore(db): add the widened media job operation check as NOT VALID and validate it separately

Follows the repository's migration convention: the constraint commits
without scanning media_jobs, and a second migration validates it with a
lock that lets reads and writes continue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
This commit is contained in:
Claude 2026-10-05 09:59:23 +00:00
parent 898c4f6388
commit 3d9dda7af1
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View File

@ -1,9 +1,10 @@
-- analyze_video jobs read a video and report its cut points to the bot; they store no files. -- analyze_video jobs read a video and report its cut points to the bot; they store no files.
-- NOT VALID commits without scanning the table; the next migration validates it.
ALTER TABLE "media_jobs" DROP CONSTRAINT "media_jobs_operation_chk"; ALTER TABLE "media_jobs" DROP CONSTRAINT "media_jobs_operation_chk";
ALTER TABLE "media_jobs" ADD CONSTRAINT "media_jobs_operation_chk" CHECK ("operation" IN ( ALTER TABLE "media_jobs" ADD CONSTRAINT "media_jobs_operation_chk" CHECK ("operation" IN (
'generate_image', 'generate_video', 'edit_image', 'edit_video', 'export_video', 'transcribe', 'generate_image', 'generate_video', 'edit_image', 'edit_video', 'export_video', 'transcribe',
'analyze_video' 'analyze_video'
)); )) NOT VALID;
-- Studio specialists keep every media tool; ones that still edit video get the new one. -- Studio specialists keep every media tool; ones that still edit video get the new one.
UPDATE "bots" UPDATE "bots"

View File

@ -0,0 +1 @@
ALTER TABLE "media_jobs" VALIDATE CONSTRAINT "media_jobs_operation_chk";