Skip to content

Commit

Permalink
Try to fix db upgrade for empty portals
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 25, 2024
1 parent e76f500 commit 75690e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database/upgrades/03-backfill-queue.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ UPDATE portal SET (oldest_message_id, oldest_message_ts) = (
AND thread_receiver = portal.receiver
ORDER BY timestamp ASC
LIMIT 1
);
) WHERE EXISTS(SELECT 1 FROM message WHERE thread_id = portal.thread_id AND thread_receiver = portal.receiver);
-- only: postgres for next 3 lines
ALTER TABLE portal ALTER COLUMN oldest_message_id DROP DEFAULT;
ALTER TABLE portal ALTER COLUMN oldest_message_ts DROP DEFAULT;
Expand Down

0 comments on commit 75690e9

Please sign in to comment.