Skip to content

Commit

Permalink
legacymigrate: maybe fix jsonb on postgres
Browse files Browse the repository at this point in the history
[skip cd]
  • Loading branch information
tulir committed Aug 15, 2024
1 parent 96b2192 commit 8db9c2f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmd/mautrix-gmessages/legacymigrate.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 8db9c2f

Please sign in to comment.