summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-09-26 15:39:13 +0100
committerErik Johnston <erik@matrix.org>2017-09-26 15:39:21 +0100
commita8e2a3df32f3584d728021d5feafecf78b0f37d1 (patch)
treebc03b29b34019d66d26f08f642863a769e240e26
parentMerge pull request #2471 from matrix-org/erikj/group_summary_publicised (diff)
downloadsynapse-a8e2a3df32f3584d728021d5feafecf78b0f37d1.tar.xz
Add unique index to group_rooms table
-rw-r--r--synapse/groups/groups_server.py2
-rw-r--r--synapse/storage/schema/delta/43/group_server.sql2
2 files changed, 1 insertions, 3 deletions
diff --git a/synapse/groups/groups_server.py b/synapse/groups/groups_server.py
index 94cf9788bb..699d8a5265 100644
--- a/synapse/groups/groups_server.py
+++ b/synapse/groups/groups_server.py
@@ -466,8 +466,6 @@ class GroupsServerHandler(object):
             group_id, and_exists=True, and_is_admin=requester_user_id
         )
 
-        # TODO: Check if room has already been added
-
         is_public = _parse_visibility_from_contents(content)
 
         yield self.store.add_room_to_group(group_id, room_id, is_public=is_public)
diff --git a/synapse/storage/schema/delta/43/group_server.sql b/synapse/storage/schema/delta/43/group_server.sql
index e74554381f..b2333848a0 100644
--- a/synapse/storage/schema/delta/43/group_server.sql
+++ b/synapse/storage/schema/delta/43/group_server.sql
@@ -52,7 +52,7 @@ CREATE TABLE group_rooms (
     is_public BOOLEAN NOT NULL  -- whether the room can be seen by everyone
 );
 
-CREATE INDEX groups_rooms_g_idx ON group_rooms(group_id, room_id);
+CREATE UNIQUE INDEX groups_rooms_g_idx ON group_rooms(group_id, room_id);
 CREATE INDEX groups_rooms_r_idx ON group_rooms(room_id);