summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-07-14 14:02:00 +0100
committerErik Johnston <erik@matrix.org>2017-07-14 14:02:31 +0100
commit4b203bdba51a314abef56ccee4d77e1945d16735 (patch)
tree3c5566a25662b449a662f40996d7baca50ef55e6 /synapse/storage
parentRemove unused functions (diff)
downloadsynapse-4b203bdba51a314abef56ccee4d77e1945d16735.tar.xz
Correctly increment orders
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/group_server.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index 2e05c23fd7..c23dc79ca5 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -184,7 +184,7 @@ class GroupServerStore(SQLBaseStore):
                 txn.execute("""
                     INSERT INTO group_summary_room_categories
                     (group_id, category_id, cat_order)
-                    SELECT ?, ?, COALESCE(MAX(cat_order), 1)
+                    SELECT ?, ?, COALESCE(MAX(cat_order), 0) + 1
                     FROM group_summary_room_categories
                     WHERE group_id = ? AND category_id = ?
                 """, (group_id, category_id, group_id, category_id))
@@ -457,7 +457,7 @@ class GroupServerStore(SQLBaseStore):
                 txn.execute("""
                     INSERT INTO group_summary_roles
                     (group_id, role_id, role_order)
-                    SELECT ?, ?, COALESCE(MAX(role_order), 1)
+                    SELECT ?, ?, COALESCE(MAX(role_order), 0) + 1
                     FROM group_summary_roles
                     WHERE group_id = ? AND role_id = ?
                 """, (group_id, role_id, group_id, role_id))