Files
Agent-System/scripts/fix-test-env-triage-data.sql
weichenandCursor 95880bf168 docs(test): archive test-env triage fixes verification report
Record E2E PASS for global unique names, member session visibility,
and asset raw preview; release integration slot and mark task done.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 09:23:31 +00:00

40 lines
1.3 KiB
PL/PgSQL

BEGIN;
-- Step A: rename project 4 away from the canonical name first (still active).
UPDATE projects
SET name = '全自动冲击波治疗仪 (retired-4)',
updated_at = now()
WHERE id = 4;
-- Step B: retire project 4.
UPDATE projects
SET status = 'demo_retired',
updated_at = now()
WHERE id = 4;
-- Step C: restore project 5 canonical name.
UPDATE projects
SET name = '全自动冲击波治疗仪',
updated_at = now()
WHERE id = 5;
-- Step D: fix session owners.
UPDATE chat_sessions SET user_id = 32, updated_at = now()
WHERE session_id = 'sess-p5-u32' AND project_id = 5 AND user_id = 4;
UPDATE chat_sessions SET user_id = 33, updated_at = now()
WHERE session_id = 'sess-p5-u33' AND project_id = 5 AND user_id = 4;
INSERT INTO chat_sessions (session_id, user_id, project_id, title, created_at, updated_at)
VALUES ('sess-p5-u35', 35, 5, '全自动冲击波治疗仪', now(), now())
ON CONFLICT (session_id) DO UPDATE SET
user_id = EXCLUDED.user_id,
project_id = EXCLUDED.project_id,
title = COALESCE(NULLIF(EXCLUDED.title, ''), chat_sessions.title),
updated_at = now();
COMMIT;
SELECT id, name, creator_user_id, status FROM projects WHERE id IN (4,5) ORDER BY id;
SELECT session_id, user_id, project_id FROM chat_sessions WHERE project_id=5 ORDER BY session_id;