fix: 减少自定义情景中数据库表对 prompt 的约束

This commit is contained in:
hhs
2026-06-23 22:58:02 +08:00
parent 9523fe6650
commit 5ef059eb40
4 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
-- 005_fix_user_scenarios_description.down.sql
-- 回滚恢复原约束description 必填prompt 最小长度 50
-- 注意:如果表中存在不符合原约束的数据,此回滚会失败
-- 1. 恢复 description 为必填
ALTER TABLE user_scenarios
ALTER COLUMN description SET NOT NULL;
-- 2. 恢复 prompt 最小长度为 50
ALTER TABLE user_scenarios
DROP CONSTRAINT IF EXISTS check_prompt_length;
ALTER TABLE user_scenarios
ADD CONSTRAINT check_prompt_length CHECK (char_length(prompt) >= 50 AND char_length(prompt) <= 2000);