mirror of
https://github.com/openai/codex.git
synced 2026-09-08 15:50:34 +00:00
fix legacy thread name writes
This commit is contained in:
@@ -15,3 +15,14 @@ WHERE title <> ''
|
||||
UPDATE threads
|
||||
SET title_snapshot = title
|
||||
WHERE name_state = 'legacy_unknown';
|
||||
|
||||
CREATE TRIGGER threads_title_snapshot_after_insert
|
||||
AFTER INSERT ON threads
|
||||
WHEN NEW.title_snapshot = ''
|
||||
AND NEW.title <> ''
|
||||
AND NEW.title_state = 'legacy_unknown'
|
||||
BEGIN
|
||||
UPDATE threads
|
||||
SET title_snapshot = NEW.title
|
||||
WHERE id = NEW.id;
|
||||
END;
|
||||
|
||||
@@ -946,13 +946,16 @@ ON CONFLICT(id) DO UPDATE SET
|
||||
cli_version = excluded.cli_version,
|
||||
name = CASE
|
||||
WHEN threads.title <> threads.title_snapshot THEN NULLIF(threads.title, '')
|
||||
WHEN threads.name_state <> 'legacy_unknown' THEN threads.name
|
||||
WHEN excluded.name_state = 'explicit' THEN excluded.name
|
||||
WHEN excluded.name_state = 'cleared' THEN NULL
|
||||
WHEN threads.name_state IN ('explicit', 'cleared') THEN threads.name
|
||||
WHEN excluded.name_state = 'legacy_unknown' THEN NULL
|
||||
ELSE excluded.name
|
||||
END,
|
||||
name_state = CASE
|
||||
WHEN threads.title <> threads.title_snapshot THEN CASE WHEN threads.title = '' THEN 'cleared' ELSE 'explicit' END
|
||||
WHEN threads.name_state <> 'legacy_unknown' THEN threads.name_state
|
||||
WHEN excluded.name_state IN ('explicit', 'cleared') THEN excluded.name_state
|
||||
WHEN threads.name_state IN ('explicit', 'cleared') THEN threads.name_state
|
||||
WHEN excluded.name_state = 'legacy_unknown' THEN 'unnamed'
|
||||
ELSE excluded.name_state
|
||||
END,
|
||||
|
||||
Reference in New Issue
Block a user