- add account-level auto rating and daily polish tasks\n- add cached historical chat, media, emoji, and per-account realtime sync\n- add SQLite, MySQL, and PostgreSQL migrations and regression coverage\n- align account, sidebar, and chat interfaces with the new workflows
13 lines
497 B
SQL
13 lines
497 B
SQL
-- +goose Up
|
|
UPDATE chat_messages SET direction='outgoing', sender_name='我'
|
|
WHERE sender_id=cookie_id AND direction='incoming';
|
|
UPDATE chat_sessions SET buyer_id=COALESCE((
|
|
SELECT m.sender_id FROM chat_messages m
|
|
WHERE m.cookie_id=chat_sessions.cookie_id AND m.chat_id=chat_sessions.chat_id
|
|
AND m.direction='incoming' AND m.sender_id<>chat_sessions.cookie_id
|
|
ORDER BY m.sent_at DESC,m.id DESC LIMIT 1
|
|
), buyer_id);
|
|
|
|
-- +goose Down
|
|
-- Data repair is intentionally irreversible.
|