From d3aa329769c09bb0614948358db2d5f98066c32a Mon Sep 17 00:00:00 2001
From: Badlop <badlop@process-one.net>
Date: Thu, 14 Oct 2021 13:31:46 +0200
Subject: Fix vcard_search definition in pgsql new schema (thanks to Stu
 Tomlinson)(#3695)

How to update an existing database:
ALTER TABLE vcard_search DROP CONSTRAINT vcard_search_pkey;
ALTER TABLE vcard_search ADD PRIMARY KEY (server_host, lusername);
---
 sql/pg.new.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'sql/pg.new.sql')

diff --git a/sql/pg.new.sql b/sql/pg.new.sql
index b3473a1a0..6a0743f23 100644
--- a/sql/pg.new.sql
+++ b/sql/pg.new.sql
@@ -311,7 +311,7 @@ CREATE TABLE vcard_search (
     lorgname text NOT NULL,
     orgunit text NOT NULL,
     lorgunit text NOT NULL,
-    PRIMARY KEY (server_host, username)
+    PRIMARY KEY (server_host, lusername)
 );
 
 CREATE INDEX i_vcard_search_sh_lfn       ON vcard_search(server_host, lfn);
-- 
cgit v1.2.3


From 8b7da70b57096d5c88c4128877e8802a12057bd4 Mon Sep 17 00:00:00 2001
From: Alexey Shchepin <alexey@process-one.net>
Date: Tue, 14 Dec 2021 09:54:00 +0300
Subject: Handle user removal in mod_muc

---
 sql/pg.new.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'sql/pg.new.sql')

diff --git a/sql/pg.new.sql b/sql/pg.new.sql
index 6a0743f23..5ffbedde3 100644
--- a/sql/pg.new.sql
+++ b/sql/pg.new.sql
@@ -495,6 +495,7 @@ CREATE TABLE muc_room_subscribers (
 );
 
 CREATE INDEX i_muc_room_subscribers_host_jid ON muc_room_subscribers USING btree (host, jid);
+CREATE INDEX i_muc_room_subscribers_jid ON muc_room_subscribers USING btree (jid);
 CREATE UNIQUE INDEX i_muc_room_subscribers_host_room_jid ON muc_room_subscribers USING btree (host, room, jid);
 
 CREATE TABLE motd (
-- 
cgit v1.2.3

