Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix schema delta error in 1.85 #15738

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15738.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in schema delta that broke upgrades for some deployments. Introduced in v1.85.0.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ DELETE FROM background_updates WHERE update_name = 'event_push_backfill_thread_i
-- Overwrite any null thread_id values.
UPDATE event_push_actions_staging SET thread_id = 'main' WHERE thread_id IS NULL;
UPDATE event_push_actions SET thread_id = 'main' WHERE thread_id IS NULL;

-- Empirically we can end up with entries in the push summary table with both a
-- `NULL` and `main` thread ID, which causes the update below to fail. We fudge
-- this by deleting any `NULL` rows that have a corresponding `main`.
DELETE FROM event_push_summary AS a WHERE thread_id IS NULL AND EXISTS (
SELECT 1 FROM event_push_summary AS b
WHERE b.thread_id = 'main' AND a.user_id = b.user_id AND a.room_id = b.room_id
);
UPDATE event_push_summary SET thread_id = 'main' WHERE thread_id IS NULL;

-- Drop the background updates to calculate the indexes used to find null thread_ids.
Expand Down