fix: migration 020 - make template column nullable
Issue: template has NOT NULL constraint but pipeline-type prompts don't use template (they use stages JSONB instead). Solution: ALTER COLUMN template DROP NOT NULL before inserting pipeline configs into ai_prompts.
This commit is contained in:
parent
95dcf080e5
commit
33653fdfd4
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user