aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2021-05-18 18:29:32 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2021-05-18 18:29:32 +0200
commit95fa43aa96514b7e8b77fa7c29d2c0b5b1c1331a (patch)
tree67b20230cac30258296cd4dc8bb1a08816c0d49a /sql
parentNew simple webadmin pages to view mnesia tables information and content (diff)
Add missing indexes to sql sr_group tables
Diffstat (limited to 'sql')
-rw-r--r--sql/lite.new.sql3
-rw-r--r--sql/lite.sql2
-rw-r--r--sql/mysql.new.sql3
-rw-r--r--sql/mysql.sql2
-rw-r--r--sql/pg.new.sql3
-rw-r--r--sql/pg.sql2
6 files changed, 15 insertions, 0 deletions
diff --git a/sql/lite.new.sql b/sql/lite.new.sql
index be971c8d8..96c880358 100644
--- a/sql/lite.new.sql
+++ b/sql/lite.new.sql
@@ -73,6 +73,8 @@ CREATE TABLE sr_group (
PRIMARY KEY (server_host, name)
);
+CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group (server_host, name);
+
CREATE TABLE sr_user (
jid text NOT NULL,
server_host text NOT NULL,
@@ -81,6 +83,7 @@ CREATE TABLE sr_user (
PRIMARY KEY (server_host, jid, grp)
);
+CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user (server_host, jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user (server_host, jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user (server_host, grp);
diff --git a/sql/lite.sql b/sql/lite.sql
index 445d29957..087035d7f 100644
--- a/sql/lite.sql
+++ b/sql/lite.sql
@@ -65,6 +65,8 @@ CREATE TABLE sr_group (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
+CREATE UNIQUE INDEX i_sr_group_name ON sr_group (name);
+
CREATE TABLE sr_user (
jid text NOT NULL,
grp text NOT NULL,
diff --git a/sql/mysql.new.sql b/sql/mysql.new.sql
index b29a003eb..ed4f93348 100644
--- a/sql/mysql.new.sql
+++ b/sql/mysql.new.sql
@@ -76,6 +76,8 @@ CREATE TABLE sr_group (
PRIMARY KEY (server_host(191), name)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group(server_host(191), name);
+
CREATE TABLE sr_user (
jid varchar(191) NOT NULL,
server_host varchar(191) NOT NULL,
@@ -84,6 +86,7 @@ CREATE TABLE sr_user (
PRIMARY KEY (server_host(191), jid, grp)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+CREATE UNIQUE INDEX i_sr_user_sh_jid_group ON sr_group(server_host(191), jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user(server_host(191), jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user(server_host(191), grp);
diff --git a/sql/mysql.sql b/sql/mysql.sql
index 9583aeb2d..33ef98d30 100644
--- a/sql/mysql.sql
+++ b/sql/mysql.sql
@@ -68,6 +68,8 @@ CREATE TABLE sr_group (
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+CREATE UNIQUE INDEX i_sr_group_name ON sr_group(name);
+
CREATE TABLE sr_user (
jid varchar(191) NOT NULL,
grp varchar(191) NOT NULL,
diff --git a/sql/pg.new.sql b/sql/pg.new.sql
index d5b1f16bf..8a35ec6c9 100644
--- a/sql/pg.new.sql
+++ b/sql/pg.new.sql
@@ -218,6 +218,8 @@ CREATE TABLE sr_group (
PRIMARY KEY (server_host, name)
);
+CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group USING btree (server_host, name);
+
CREATE TABLE sr_user (
jid text NOT NULL,
server_host text NOT NULL,
@@ -226,6 +228,7 @@ CREATE TABLE sr_user (
PRIMARY KEY (server_host, jid, grp)
);
+CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user USING btree (server_host, jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user USING btree (server_host, jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user USING btree (server_host, grp);
diff --git a/sql/pg.sql b/sql/pg.sql
index 079221c27..0e3d4c8b8 100644
--- a/sql/pg.sql
+++ b/sql/pg.sql
@@ -69,6 +69,8 @@ CREATE TABLE sr_group (
created_at TIMESTAMP NOT NULL DEFAULT now()
);
+CREATE UNIQUE INDEX i_sr_group_name ON sr_group USING btree (name);
+
CREATE TABLE sr_user (
jid text NOT NULL,
grp text NOT NULL,