From 8db9c2fe053da0a23d4846a34436cf935f8b1fab Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 15 Aug 2024 23:19:07 +0300 Subject: [PATCH] legacymigrate: maybe fix jsonb on postgres [skip cd] --- cmd/mautrix-gmessages/legacymigrate.sql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/mautrix-gmessages/legacymigrate.sql b/cmd/mautrix-gmessages/legacymigrate.sql index bc9186d..253583d 100644 --- a/cmd/mautrix-gmessages/legacymigrate.sql +++ b/cmd/mautrix-gmessages/legacymigrate.sql @@ -133,11 +133,12 @@ INSERT INTO ghost ( ) SELECT DISTINCT '', CAST(conv_receiver AS TEXT) || '.' || sender, '', '', '', '', false, false, false, false, - -- only: postgres + -- only: postgres for next 2 lines '[]'::jsonb, - -- only: sqlite (line commented) --- '[]', - '{}' + '{}'::jsonb + -- only: sqlite for next 2 lines (lines commented) +-- '[]', +-- '{}' FROM message_old WHERE true ON CONFLICT DO NOTHING; @@ -176,7 +177,10 @@ SELECT mxid, (SELECT (timestamp * 1000) + 1 FROM message_old WHERE conv_receiver=reaction_old.conv_receiver and id=reaction_old.msg_id), -- timestamp reaction, -- emoji - '{}' -- metadata + -- only: postgres + '{}'::jsonb + -- only: sqlite (line commented) +-- '{}' FROM reaction_old WHERE EXISTS(SELECT 1 FROM message_old WHERE message_old.conv_receiver=reaction_old.conv_receiver and message_old.id=reaction_old.msg_id);