From 9d86c8c7a68fdbfa49df8bb027a112158df40bb8 Mon Sep 17 00:00:00 2001
From: Erik Johnston <lightportal@gmail.com>
Date: Sun, 24 Aug 2014 11:28:03 +0100
Subject: Add a unique constraint on the room hosts table

---
 synapse/storage/schema/im.sql | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'synapse/storage/schema/im.sql')

diff --git a/synapse/storage/schema/im.sql b/synapse/storage/schema/im.sql
index 7f4e758892..e92f21ef3b 100644
--- a/synapse/storage/schema/im.sql
+++ b/synapse/storage/schema/im.sql
@@ -98,5 +98,6 @@ CREATE TABLE IF NOT EXISTS rooms(
 
 CREATE TABLE IF NOT EXISTS room_hosts(
     room_id TEXT NOT NULL,
-    host TEXT NOT NULL
+    host TEXT NOT NULL,
+    CONSTRAINT room_hosts_uniq UNIQUE (room_id, host) ON CONFLICT IGNORE
 );
-- 
cgit 1.4.1

