imetting_backend/sql/add_prompt_id_to_llm_tasks.sql

12 lines
496 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- 为 llm_tasks 表添加 prompt_id 列,用于支持自定义模版选择功能
-- 执行日期2025-12-08
ALTER TABLE `llm_tasks`
ADD COLUMN `prompt_id` int(11) DEFAULT NULL COMMENT '提示词模版ID' AFTER `user_prompt`,
ADD KEY `idx_prompt_id` (`prompt_id`);
-- 说明:
-- 1. prompt_id 允许为 NULL表示使用默认模版
-- 2. 添加索引以优化查询性能
-- 3. 不添加外键约束,因为 prompts 表中的记录可能被删除,我们希望保留历史任务记录