admin/sql/20260801_global_ai_provider.sql
zzh 592054f062 feat: extract global AI service and persist sales-product publish AI reports
Move provider/chat APIs from /xhs/ai to /ai, rename t_ai_provider, and require adopted AI analysis on price publish.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 15:56:40 +08:00

17 lines
630 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 全局 AI 提供商:从小红书域表迁出(未上线环境可直接改名)
-- 若表尚不存在则跳过;若已是 t_ai_provider 则无需执行。
RENAME TABLE `t_xhs_ai_provider` TO `t_ai_provider`;
ALTER TABLE `t_ai_provider`
COMMENT = '全局 AI 提供商配置表(CustomerId=0 表示平台级)';
-- 索引名顺带规范化(可选,失败可忽略)
ALTER TABLE `t_ai_provider`
DROP INDEX `uk_xhs_ai_provider`,
ADD UNIQUE KEY `uk_ai_provider` (`CustomerId`, `ProviderKey`);
ALTER TABLE `t_ai_provider`
DROP INDEX `idx_xhs_ai_customer`,
ADD KEY `idx_ai_customer` (`CustomerId`, `Enabled`);