-- 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" ADD CONSTRAINT "media_jobs_operation_chk" CHECK ("operation" IN ( 'generate_image', 'generate_video', 'edit_image', 'edit_video', 'export_video', 'transcribe', 'analyze_video' )) NOT VALID; -- Studio specialists keep every media tool; ones that still edit video get the new one. UPDATE "bots" SET "allowedBuiltinTools" = array_append("allowedBuiltinTools", 'analyze_video') WHERE "spawnKey" LIKE 'media:studio:%' AND "restrictBuiltinTools" AND 'edit_video' = ANY("allowedBuiltinTools") AND NOT ('analyze_video' = ANY("allowedBuiltinTools"));