DELETE FROM prompts
WHERE id = '2eb481cf-4a8f-4da4-a70e-ea977739c8d1'
  AND type = '剧本分析';

DROP INDEX IF EXISTS uq_script_analysis_active_task;
DROP INDEX IF EXISTS idx_generation_tasks_script_analysis;
ALTER TABLE generation_tasks DROP COLUMN IF EXISTS script_analysis_id;
ALTER TABLE generation_tasks DROP CONSTRAINT generation_tasks_task_type_check;
ALTER TABLE generation_tasks
    ADD CONSTRAINT generation_tasks_task_type_check
    CHECK (task_type IN ('prompt_reverse', 'image_generation', 'video_generation'));

DROP TABLE IF EXISTS script_analysis_characters;
ALTER TABLE script_analyses DROP CONSTRAINT IF EXISTS script_analyses_status_check;
ALTER TABLE script_analyses
    DROP COLUMN IF EXISTS analysis_message,
    DROP COLUMN IF EXISTS analysis_status,
    DROP COLUMN IF EXISTS analysis_result;
