Skip to content

Commit

Permalink
Merge pull request #3980 from nosnilmot/sql-maintenance
Browse files Browse the repository at this point in the history
SQL related fixes and updates
  • Loading branch information
prefiks authored Jan 20, 2023
2 parents 758c87f + 4f0e426 commit baf1336
Show file tree
Hide file tree
Showing 17 changed files with 953 additions and 229 deletions.
13 changes: 1 addition & 12 deletions sql/lite.new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ CREATE TABLE rosterusers (
);

CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers (server_host, username, jid);
CREATE INDEX i_rosteru_sh_username ON rosterusers (server_host, username);
CREATE INDEX i_rosteru_sh_jid ON rosterusers (server_host, jid);


Expand Down Expand Up @@ -84,7 +83,6 @@ CREATE TABLE sr_user (
);

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);

CREATE TABLE spool (
Expand Down Expand Up @@ -190,7 +188,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX i_privacy_list_sh_username ON privacy_list (server_host, username);
CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list (server_host, username, name);

CREATE TABLE privacy_list_data (
Expand All @@ -215,9 +212,6 @@ CREATE TABLE private_storage (
PRIMARY KEY (server_host, username, namespace)
);

CREATE INDEX i_private_storage_sh_username ON private_storage (server_host, username);


CREATE TABLE roster_version (
username text NOT NULL,
server_host text NOT NULL,
Expand Down Expand Up @@ -319,7 +313,6 @@ CREATE TABLE muc_online_users (
);

CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users (username, server);

CREATE TABLE muc_room_subscribers (
room text NOT NULL,
Expand Down Expand Up @@ -389,7 +382,6 @@ CREATE TABLE route (
);

CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route(domain);

CREATE TABLE bosh (
sid text NOT NULL,
Expand Down Expand Up @@ -422,6 +414,7 @@ CREATE TABLE push_session (
);

CREATE UNIQUE INDEX i_push_session_susn ON push_session (server_host, username, service, node);
CREATE INDEX i_push_session_sh_username_timestamp ON push_session (server_host, username, timestamp);

CREATE TABLE mix_channel (
channel text NOT NULL,
Expand Down Expand Up @@ -449,7 +442,6 @@ CREATE TABLE mix_participant (
);

CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);

CREATE TABLE mix_subscription (
channel text NOT NULL,
Expand All @@ -461,9 +453,7 @@ CREATE TABLE mix_subscription (
);

CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);

CREATE TABLE mix_pam (
username text NOT NULL,
Expand All @@ -475,7 +465,6 @@ CREATE TABLE mix_pam (
);

CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username, server_host);

CREATE TABLE mqtt_pub (
username text NOT NULL,
Expand Down
10 changes: 0 additions & 10 deletions sql/lite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ CREATE TABLE rosterusers (
);

CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers (username, jid);
CREATE INDEX i_rosteru_username ON rosterusers (username);
CREATE INDEX i_rosteru_jid ON rosterusers (jid);


Expand All @@ -74,7 +73,6 @@ CREATE TABLE sr_user (
);

CREATE UNIQUE INDEX i_sr_user_jid_grp ON sr_user (jid, grp);
CREATE INDEX i_sr_user_jid ON sr_user (jid);
CREATE INDEX i_sr_user_grp ON sr_user (grp);

CREATE TABLE spool (
Expand Down Expand Up @@ -169,7 +167,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX i_privacy_list_username ON privacy_list (username);
CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list (username, name);

CREATE TABLE privacy_list_data (
Expand All @@ -192,7 +189,6 @@ CREATE TABLE private_storage (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX i_private_storage_username ON private_storage (username);
CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage (username, namespace);


Expand Down Expand Up @@ -291,7 +287,6 @@ CREATE TABLE muc_online_users (
);

CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users (username, server);

CREATE TABLE muc_room_subscribers (
room text NOT NULL,
Expand Down Expand Up @@ -358,7 +353,6 @@ CREATE TABLE route (
);

CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route(domain);

CREATE TABLE bosh (
sid text NOT NULL,
Expand Down Expand Up @@ -417,7 +411,6 @@ CREATE TABLE mix_participant (
);

CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);

CREATE TABLE mix_subscription (
channel text NOT NULL,
Expand All @@ -429,9 +422,7 @@ CREATE TABLE mix_subscription (
);

CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);

CREATE TABLE mix_pam (
username text NOT NULL,
Expand All @@ -442,7 +433,6 @@ CREATE TABLE mix_pam (
);

CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username);

CREATE TABLE mqtt_pub (
username text NOT NULL,
Expand Down
Loading

0 comments on commit baf1336

Please sign in to comment.