diff --git a/backend/migrations/020_unified_prompt_system.sql b/backend/migrations/020_unified_prompt_system.sql index 5fd022d..7d69df2 100644 --- a/backend/migrations/020_unified_prompt_system.sql +++ b/backend/migrations/020_unified_prompt_system.sql @@ -2,13 +2,17 @@ -- Consolidate ai_prompts and pipeline_configs into single system -- Type: 'base' (reusable building blocks) or 'pipeline' (workflows) --- Step 1: Add new columns to ai_prompts +-- Step 1: Add new columns to ai_prompts and make template nullable ALTER TABLE ai_prompts ADD COLUMN IF NOT EXISTS type VARCHAR(20) DEFAULT 'pipeline', ADD COLUMN IF NOT EXISTS stages JSONB, ADD COLUMN IF NOT EXISTS output_format VARCHAR(10) DEFAULT 'text', ADD COLUMN IF NOT EXISTS output_schema JSONB; +-- Make template nullable (pipeline-type prompts use stages instead) +ALTER TABLE ai_prompts +ALTER COLUMN template DROP NOT NULL; + -- Step 2: Migrate existing single-prompts to 1-stage pipeline format -- All existing prompts become single-stage pipelines with inline source UPDATE ai_prompts