docs: 移动蓝绿部署指南到 troubleshooting 目录
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- =============================================================================
|
||||
-- 企微IT智能服务台 — 数据库迁移脚本
|
||||
-- =============================================================================
|
||||
-- 说明:为 conversations 表添加超时提醒相关字段
|
||||
-- 执行时机:在部署 MSG-P2-02 功能前执行
|
||||
-- 兼容性:PostgreSQL
|
||||
-- =============================================================================
|
||||
|
||||
-- 添加超时提醒相关字段
|
||||
ALTER TABLE conversations
|
||||
ADD COLUMN IF NOT EXISTS last_agent_reply_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
||||
ADD COLUMN IF NOT EXISTS reminder_sent BOOLEAN DEFAULT FALSE NOT NULL,
|
||||
ADD COLUMN IF NOT EXISTS reminder_sent_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
||||
ADD COLUMN IF NOT EXISTS pending_close_at TIMESTAMP WITH TIME ZONE DEFAULT NULL;
|
||||
|
||||
-- 添加索引以优化查询性能
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_last_agent_reply_at
|
||||
ON conversations(last_agent_reply_at)
|
||||
WHERE last_agent_reply_at IS NOT NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_reminder_sent
|
||||
ON conversations(reminder_sent)
|
||||
WHERE reminder_sent = FALSE;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_pending_close_at
|
||||
ON conversations(pending_close_at)
|
||||
WHERE pending_close_at IS NOT NULL;
|
||||
|
||||
-- 回滚脚本(如果需要回滚)
|
||||
-- ALTER TABLE conversations
|
||||
-- DROP COLUMN IF EXISTS last_agent_reply_at,
|
||||
-- DROP COLUMN IF EXISTS reminder_sent,
|
||||
-- DROP COLUMN IF EXISTS reminder_sent_at,
|
||||
-- DROP COLUMN IF EXISTS pending_close_at;
|
||||
--
|
||||
-- DROP INDEX IF EXISTS idx_conversations_last_agent_reply_at;
|
||||
-- DROP INDEX IF EXISTS idx_conversations_reminder_sent;
|
||||
-- DROP INDEX IF EXISTS idx_conversations_pending_close_at;
|
||||
Reference in New Issue
Block a user