sync: bring over remaining release/custom-0.1.115 changes
- Extract PublicSettingsInjectionPayload named struct with drift test - Add channel_monitor_default_interval_seconds to SSR injection - Add image_output_price to SupportedModelChip - Simplify AppSidebar buildSelfNavItems (admins see available channels) - Add gateway WARN logs for 503 no-available-accounts branches - Wire ChannelMonitorRunner into provideCleanup for graceful shutdown - Add migrations 130/131 (CC template userid fix + mimicry field cleanup) - Clean up fork-only features (sora, claude max simulation, client affinity) - Remove ~320 obsolete i18n keys - Add codexUsage utility, WechatServiceButton, BulkEditAccountModal - Tidy go.sum
This commit is contained in:
36
backend/migrations/130_fix_claude_code_template_userid.sql
Normal file
36
backend/migrations/130_fix_claude_code_template_userid.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- Migration: 114_fix_claude_code_template_userid
|
||||
-- 113 的 seed 使用 legacy 格式的 metadata.user_id,但已部署环境此前是手工建的
|
||||
-- 「Claude Code 伪装」模板(用新版 JSON-string 格式 user_id),113 的 ON CONFLICT
|
||||
-- DO NOTHING 不会覆盖。本 migration 定向修复这一条历史记录及其下游监控快照。
|
||||
--
|
||||
-- 安全性:WHERE 条件同时匹配 (provider, name) + user_id 以 '{' 开头,
|
||||
-- 所以:
|
||||
-- - 用户自己改过 user_id(或者 seed 本来就是 legacy)→ LIKE 不中,保持原状
|
||||
-- - 用户改过 template name / provider → WHERE 不中,完全跳过
|
||||
-- 幂等:第二次跑时 user_id 已经是 legacy 格式,LIKE '{%' 不中,UPDATE 0 行。
|
||||
|
||||
UPDATE channel_monitor_request_templates
|
||||
SET body_override = jsonb_set(
|
||||
body_override,
|
||||
'{metadata,user_id}',
|
||||
'"user_0000000000000000000000000000000000000000000000000000000000000000_account_00000000-0000-0000-0000-000000000000_session_00000000-0000-0000-0000-000000000000"'::jsonb,
|
||||
false
|
||||
),
|
||||
updated_at = NOW()
|
||||
WHERE provider = 'anthropic'
|
||||
AND name = 'Claude Code 伪装'
|
||||
AND body_override #>> '{metadata,user_id}' LIKE '{%';
|
||||
|
||||
-- 同步已应用此模板的监控快照(监控采用 snapshot 语义,只更新那些明显还是 seed 原样的)。
|
||||
UPDATE channel_monitors m
|
||||
SET body_override = jsonb_set(
|
||||
m.body_override,
|
||||
'{metadata,user_id}',
|
||||
'"user_0000000000000000000000000000000000000000000000000000000000000000_account_00000000-0000-0000-0000-000000000000_session_00000000-0000-0000-0000-000000000000"'::jsonb,
|
||||
false
|
||||
)
|
||||
FROM channel_monitor_request_templates t
|
||||
WHERE m.template_id = t.id
|
||||
AND t.provider = 'anthropic'
|
||||
AND t.name = 'Claude Code 伪装'
|
||||
AND m.body_override #>> '{metadata,user_id}' LIKE '{%';
|
||||
Reference in New Issue
Block a user