summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-06-12 15:05:47 +0100
committerBrendan Abolivier <babolivier@matrix.org>2020-06-12 15:05:47 +0100
commit1e5a50302f1b481e56019f2cc1c99b34183845af (patch)
treebe43dae8e57893cc02221f9c8472d539152e5d04 /synapse/storage
parentDon't update the schema version (diff)
downloadsynapse-1e5a50302f1b481e56019f2cc1c99b34183845af.tar.xz
Pre-populate the unread_count column
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/data_stores/main/schema/delta/58/07push_summary_unread_count.sql5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/data_stores/main/schema/delta/58/07push_summary_unread_count.sql b/synapse/storage/data_stores/main/schema/delta/58/07push_summary_unread_count.sql
index 560858d88b..f1459ef7f0 100644
--- a/synapse/storage/data_stores/main/schema/delta/58/07push_summary_unread_count.sql
+++ b/synapse/storage/data_stores/main/schema/delta/58/07push_summary_unread_count.sql
@@ -16,3 +16,8 @@
 -- Store the number of unread messages, i.e. messages that triggered either a notify
 -- action or a mark_unread one.
 ALTER TABLE event_push_summary ADD COLUMN unread_count BIGINT NOT NULL DEFAULT 0;
+
+-- Pre-populate the new column with the count of pending notifications.
+-- We expect event_push_summary to be relatively small, so we can do this update
+-- synchronously without impacting Synapse's startup time too much.
+UPDATE event_push_summary SET unread_count = notif_count;
\ No newline at end of file