diff --git a/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go b/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go index 147a1c63d..4c25a45cd 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go +++ b/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go @@ -27,10 +27,6 @@ import ( "github.com/matrix-org/util" ) -type roomID struct { - RoomID string `json:"room_id"` -} - // DirectoryRoom looks up a room alias func DirectoryRoom( req *http.Request, @@ -118,7 +114,9 @@ func SetLocalAlias( } } - var r roomID + var r struct { + RoomID string `json:"room_id"` + } if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil { return *resErr } diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go index a060a1b50..8b56b6d14 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go @@ -26,6 +26,8 @@ CREATE TABLE IF NOT EXISTS room_aliases ( -- Room ID the alias refers to room_id TEXT NOT NULL ); + +CREATE UNIQUE INDEX IF NOT EXISTS room_id_idx ON room_aliases(room_id); ` const insertRoomAliasSQL = "" +