Add unique index to group_rooms table

This commit is contained in:
Erik Johnston 2017-09-26 15:39:13 +01:00
parent 0d7c7fd907
commit a8e2a3df32
2 changed files with 1 additions and 3 deletions

View File

@ -466,8 +466,6 @@ class GroupsServerHandler(object):
group_id, and_exists=True, and_is_admin=requester_user_id 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) is_public = _parse_visibility_from_contents(content)
yield self.store.add_room_to_group(group_id, room_id, is_public=is_public) yield self.store.add_room_to_group(group_id, room_id, is_public=is_public)

View File

@ -52,7 +52,7 @@ CREATE TABLE group_rooms (
is_public BOOLEAN NOT NULL -- whether the room can be seen by everyone 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); CREATE INDEX groups_rooms_r_idx ON group_rooms(room_id);