-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for backfilling messages
- Loading branch information
Showing
17 changed files
with
882 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- v3: Add backfill queue | ||
ALTER TABLE portal ADD COLUMN oldest_message_id TEXT NOT NULL DEFAULT ''; | ||
ALTER TABLE portal ADD COLUMN oldest_message_ts BIGINT NOT NULL DEFAULT 0; | ||
ALTER TABLE portal ADD COLUMN more_to_backfill BOOL NOT NULL DEFAULT true; | ||
UPDATE portal SET (oldest_message_id, oldest_message_ts) = ( | ||
SELECT id, timestamp | ||
FROM message | ||
WHERE thread_id = portal.thread_id | ||
AND thread_receiver = portal.receiver | ||
ORDER BY timestamp ASC | ||
LIMIT 1 | ||
); | ||
-- 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; | ||
ALTER TABLE portal ALTER COLUMN more_to_backfill DROP DEFAULT; | ||
|
||
ALTER TABLE user_portal ADD COLUMN backfill_priority INTEGER NOT NULL DEFAULT 0; | ||
ALTER TABLE user_portal ADD COLUMN backfill_max_pages INTEGER NOT NULL DEFAULT 0; | ||
ALTER TABLE user_portal ADD COLUMN backfill_dispatched_at BIGINT NOT NULL DEFAULT 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.