From a219934f4bb34cdf8fd32d51b75c72099f09fc5e Mon Sep 17 00:00:00 2001 From: hhs <386998068@qq.com> Date: Tue, 23 Jun 2026 11:10:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=87=AA=E5=AE=9A=E4=B9=89=E6=83=85=E6=99=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/migrations/004_user_scenarios.up.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/migrations/004_user_scenarios.up.sql b/backend/migrations/004_user_scenarios.up.sql index 1fc8870..66cb7ad 100644 --- a/backend/migrations/004_user_scenarios.up.sql +++ b/backend/migrations/004_user_scenarios.up.sql @@ -6,7 +6,7 @@ CREATE TABLE user_scenarios ( user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, name VARCHAR(50) NOT NULL, icon VARCHAR(10) DEFAULT '✨', - description VARCHAR(100) NOT NULL, + description VARCHAR(100), prompt TEXT NOT NULL, greeting VARCHAR(200), language VARCHAR(10) DEFAULT 'zh-CN', @@ -15,8 +15,8 @@ CREATE TABLE user_scenarios ( CONSTRAINT unique_user_scenario UNIQUE(user_id, name), CONSTRAINT check_name_length CHECK (char_length(name) >= 2 AND char_length(name) <= 50), - CONSTRAINT check_description_length CHECK (char_length(description) >= 5 AND char_length(description) <= 100), - CONSTRAINT check_prompt_length CHECK (char_length(prompt) >= 50 AND char_length(prompt) <= 2000) + CONSTRAINT check_description_length CHECK (description IS NULL OR (char_length(description) >= 1 AND char_length(description) <= 100)), + CONSTRAINT check_prompt_length CHECK (char_length(prompt) >= 10 AND char_length(prompt) <= 2000) ); -- 为用户 ID 创建索引,加速查询 @@ -30,7 +30,7 @@ COMMENT ON COLUMN user_scenarios.id IS '情景唯一标识'; COMMENT ON COLUMN user_scenarios.user_id IS '所属用户 ID,外键关联 users 表'; COMMENT ON COLUMN user_scenarios.name IS '情景名称,如"创意写作导师"'; COMMENT ON COLUMN user_scenarios.icon IS 'Emoji 图标,如"🎨"'; -COMMENT ON COLUMN user_scenarios.description IS '简短描述,显示在情景卡片上'; +COMMENT ON COLUMN user_scenarios.description IS '简短描述,可选,显示在情景卡片上'; COMMENT ON COLUMN user_scenarios.prompt IS '角色 System Prompt,定义 AI 行为'; COMMENT ON COLUMN user_scenarios.greeting IS '首句引导,可选'; COMMENT ON COLUMN user_scenarios.language IS '默认语言,如 zh-CN、en-US';