fix(shangwutong): 来源信息改为系统消息

This commit is contained in:
Rogee
2026-08-06 17:55:54 +08:00
parent d2aeea5f44
commit dc2a6577bf
7 changed files with 114 additions and 85 deletions
@@ -0,0 +1,3 @@
-- Restoring the old custom-attribute presentation is intentionally unsupported.
-- Migration 000075 remains the historical definition of that superseded UI.
SELECT 1;
@@ -0,0 +1,52 @@
DELETE FROM custom_attribute_definitions
WHERE attribute_model = 'conversation_attribute'
AND attribute_name IN (
'swt_source_url',
'swt_source_search_term',
'swt_source_purchase_term',
'swt_source_keyword_id',
'swt_source_channel',
'swt_source_realtime_location',
'swt_source_region',
'swt_source_ad_account_id',
'swt_source_wakeable',
'swt_baidu_conversation_type',
'swt_baidu_agent_name',
'swt_baidu_ssid'
);
UPDATE conversations
SET
custom_attributes = COALESCE(custom_attributes, '{}'::jsonb)
- 'swt_source_url'
- 'swt_source_description'
- 'swt_source_search_term'
- 'swt_source_purchase_term'
- 'swt_source_keyword_id'
- 'swt_source_channel'
- 'swt_source_realtime_location'
- 'swt_source_region'
- 'swt_source_ad_account_id'
- 'swt_source_wakeable'
- 'swt_baidu_conversation_type'
- 'swt_baidu_agent_name'
- 'swt_baidu_ssid',
updated_at = CURRENT_TIMESTAMP
WHERE COALESCE(custom_attributes, '{}'::jsonb) ?| ARRAY[
'swt_source_url',
'swt_source_description',
'swt_source_search_term',
'swt_source_purchase_term',
'swt_source_keyword_id',
'swt_source_channel',
'swt_source_realtime_location',
'swt_source_region',
'swt_source_ad_account_id',
'swt_source_wakeable',
'swt_baidu_conversation_type',
'swt_baidu_agent_name',
'swt_baidu_ssid'
];
-- Historical kind=8 system messages are backfilled from the Connector SQLite
-- store because PostgreSQL intentionally does not retain the raw encoded payload.