17 lines
753 B
MySQL
17 lines
753 B
MySQL
|
|
-- 005_fix_user_scenarios_description.up.sql
|
|||
|
|
-- 修复 user_scenarios 表约束:description 允许为空,prompt 最小长度改为 10
|
|||
|
|
|
|||
|
|
-- 1. 允许 description 为空
|
|||
|
|
ALTER TABLE user_scenarios
|
|||
|
|
ALTER COLUMN description DROP NOT NULL;
|
|||
|
|
|
|||
|
|
-- 2. 修复 prompt 长度约束(从 50 改为 10,与代码一致)
|
|||
|
|
ALTER TABLE user_scenarios
|
|||
|
|
DROP CONSTRAINT IF EXISTS check_prompt_length;
|
|||
|
|
|
|||
|
|
ALTER TABLE user_scenarios
|
|||
|
|
ADD CONSTRAINT check_prompt_length CHECK (char_length(prompt) >= 10 AND char_length(prompt) <= 2000);
|
|||
|
|
|
|||
|
|
COMMENT ON COLUMN user_scenarios.description IS '简短描述,可选,显示在情景卡片上(允许为空)';
|
|||
|
|
COMMENT ON COLUMN user_scenarios.prompt IS '角色 System Prompt,定义 AI 行为(10-2000 字符)';
|