fix(init-db): add V2 consulting fields to conversations table
Add missing V2 fields to init-db.sql to match conversation.entity.ts: - consulting_stage - consulting_state - collected_info - recommended_programs - conversion_path - device_info Also add indexes for the new fields. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2c1edc26af
commit
0992523876
|
|
@ -87,6 +87,19 @@ CREATE TABLE conversations (
|
|||
feedback TEXT,
|
||||
-- 是否转化为付费(用于统计转化率)
|
||||
has_converted BOOLEAN DEFAULT FALSE,
|
||||
-- ========== V2咨询流程字段 ==========
|
||||
-- 当前咨询阶段
|
||||
consulting_stage VARCHAR(30) DEFAULT 'greeting',
|
||||
-- 咨询状态(完整的状态对象)
|
||||
consulting_state JSONB,
|
||||
-- 已收集的用户信息
|
||||
collected_info JSONB,
|
||||
-- 推荐的移民方案
|
||||
recommended_programs TEXT[],
|
||||
-- 转化路径(用户选择的下一步)
|
||||
conversion_path VARCHAR(30),
|
||||
-- 用户设备信息
|
||||
device_info JSONB,
|
||||
-- 创建时间
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
-- 更新时间
|
||||
|
|
@ -105,6 +118,10 @@ CREATE INDEX idx_conversations_status ON conversations(status);
|
|||
CREATE INDEX idx_conversations_category ON conversations(category);
|
||||
CREATE INDEX idx_conversations_created_at ON conversations(created_at DESC);
|
||||
CREATE INDEX idx_conversations_has_converted ON conversations(has_converted) WHERE has_converted = TRUE;
|
||||
-- V2索引
|
||||
CREATE INDEX idx_conversations_consulting_stage ON conversations(consulting_stage);
|
||||
CREATE INDEX idx_conversations_conversion_path ON conversations(conversion_path);
|
||||
CREATE INDEX idx_conversations_collected_info ON conversations USING GIN(collected_info);
|
||||
|
||||
-- ===========================================
|
||||
-- 消息表 (messages)
|
||||
|
|
|
|||
Loading…
Reference in New Issue