summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-06-22 12:00:45 +0100
committerGitHub <noreply@github.com>2021-06-22 12:00:45 +0100
commit33701dc11650b2df31adb7babac63c5a818648d9 (patch)
treeacc435741c3c78fb336977a2a3589565d4a993aa /synapse
parentWarn users trying to use the deprecated spam checker interface (#10210) (diff)
downloadsynapse-33701dc11650b2df31adb7babac63c5a818648d9.tar.xz
Fix schema delta to not take as long on large servers (#10227)
Introduced in #6739
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql b/synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql
index 56c0ad0003..8eb2196f6a 100644
--- a/synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql
+++ b/synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql
@@ -13,5 +13,8 @@
  * limitations under the License.
  */
 
-ALTER TABLE room_stats_current ADD COLUMN knocked_members INT NOT NULL DEFAULT '0';
-ALTER TABLE room_stats_historical ADD COLUMN knocked_members BIGINT NOT NULL DEFAULT '0';
\ No newline at end of file
+-- Existing rows will default to NULL, so anything reading from these tables
+-- needs to interpret NULL as 0. This is fine here as no existing rooms can have
+-- any knocked members.
+ALTER TABLE room_stats_current ADD COLUMN knocked_members INT;
+ALTER TABLE room_stats_historical ADD COLUMN knocked_members BIGINT;