From 0452ffc1dfa613397aab0968f46f5f5b235a42c5 Mon Sep 17 00:00:00 2001
From: Christophe Romain <christophe.romain@process-one.net>
Date: Tue, 31 Oct 2017 14:00:41 +0100
Subject: Optimize muc subscriptions handling

---
 sql/mssql.sql | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'sql/mssql.sql')

diff --git a/sql/mssql.sql b/sql/mssql.sql
index f49246ec3..83b219298 100644
--- a/sql/mssql.sql
+++ b/sql/mssql.sql
@@ -149,6 +149,18 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW
 CREATE UNIQUE CLUSTERED INDEX [muc_online_users_us] ON [muc_online_users] (username, server);
 WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
 
+CREATE TABLE [dbo].[muc_room_subscribers] (
+        [room] [varchar] (191) NOT NULL,
+        [host] [varchar] (191) NOT NULL,
+        [jid] [varchar] (191) NOT NULL,
+        [nick] [text] NOT NULL,
+        [nodes] [text] NOT NULL,
+        [created_at] [datetime] NOT NULL DEFAULT GETDATE()
+);
+
+CREATE UNIQUE CLUSTERED INDEX [muc_room_subscribers_host_room_jid] ON [muc_room_subscribers] (host, room, jid);
+CREATE INDEX [muc_room_subscribers_host_jid] ON [muc_room_subscribers] (host, jid);
+
 CREATE TABLE [dbo].[privacy_default_list] (
         [username] [varchar] (250) NOT NULL,
         [name] [varchar] (250) NOT NULL,
-- 
cgit v1.2.3

