25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Fix minor SQL schema inconsistencies

This commit is contained in:
Stu Tomlinson 2023-01-19 19:17:24 +00:00
parent c7c982b67b
commit d5bf051e79
6 changed files with 10 additions and 4 deletions

View File

@ -414,6 +414,7 @@ CREATE TABLE push_session (
); );
CREATE UNIQUE INDEX i_push_session_susn ON push_session (server_host, username, service, node); 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 ( CREATE TABLE mix_channel (
channel text NOT NULL, channel text NOT NULL,

View File

@ -527,7 +527,7 @@ CREATE TABLE [dbo].[push_session] (
CREATE UNIQUE CLUSTERED INDEX [i_push_usn] ON [push_session] (username, service, node) CREATE UNIQUE CLUSTERED INDEX [i_push_usn] ON [push_session] (username, service, node)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE UNIQUE INDEX [i_push_ut] ON [push_session] (username, timestamp) CREATE INDEX [i_push_ut] ON [push_session] (username, timestamp)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE TABLE [dbo].[mix_channel] ( CREATE TABLE [dbo].[mix_channel] (

View File

@ -432,6 +432,7 @@ CREATE TABLE push_session (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_push_session_susn ON push_session (server_host(191), username(191), service(191), node(191)); CREATE UNIQUE INDEX i_push_session_susn ON push_session (server_host(191), username(191), service(191), node(191));
CREATE INDEX i_push_session_sh_username_timestamp ON push_session (server_host, username(191), timestamp);
CREATE TABLE mix_channel ( CREATE TABLE mix_channel (
channel text NOT NULL, channel text NOT NULL,

View File

@ -17,6 +17,7 @@ BEGIN
ALTER TABLE `push_session` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `push_session` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `push_session` ADD PRIMARY KEY (`server_host`, `username`(191), `timestamp`); ALTER TABLE `push_session` ADD PRIMARY KEY (`server_host`, `username`(191), `timestamp`);
ALTER TABLE `push_session` ADD UNIQUE INDEX `i_push_session_susn` (`server_host`, `username`(191), `service`(191), `node`(191)); ALTER TABLE `push_session` ADD UNIQUE INDEX `i_push_session_susn` (`server_host`, `username`(191), `service`(191), `node`(191));
ALTER TABLE `push_session` ADD INDEX `i_push_session_sh_username_timestamp` (`server_host`, `username`(191), `timestamp`);
ALTER TABLE `roster_version` DROP PRIMARY KEY; ALTER TABLE `roster_version` DROP PRIMARY KEY;
ALTER TABLE `roster_version` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `roster_version` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `roster_version` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `roster_version` ALTER COLUMN `server_host` DROP DEFAULT;
@ -73,10 +74,10 @@ BEGIN
ALTER TABLE `last` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `last` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `last` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `last` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `last` ADD PRIMARY KEY (`server_host`, `username`); ALTER TABLE `last` ADD PRIMARY KEY (`server_host`, `username`);
ALTER TABLE `sr_group` DROP INDEX `i_sr_group_name`;
ALTER TABLE `sr_group` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `name`; ALTER TABLE `sr_group` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `name`;
ALTER TABLE `sr_group` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `sr_group` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `sr_group` ADD UNIQUE INDEX `i_sr_group_sh_name` (`server_host`, `name`); ALTER TABLE `sr_group` ADD UNIQUE INDEX `i_sr_group_sh_name` (`server_host`, `name`);
ALTER TABLE `sr_group` ADD PRIMARY KEY (`server_host`, `name`);
ALTER TABLE `muc_registered` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`; ALTER TABLE `muc_registered` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`;
ALTER TABLE `muc_registered` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `muc_registered` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `sm` DROP INDEX `i_node`; ALTER TABLE `sm` DROP INDEX `i_node`;
@ -99,7 +100,6 @@ BEGIN
ALTER TABLE `sr_user` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `sr_user` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `sr_user` ADD UNIQUE INDEX `i_sr_user_sh_jid_group` (`server_host`, `jid`, `grp`); ALTER TABLE `sr_user` ADD UNIQUE INDEX `i_sr_user_sh_jid_group` (`server_host`, `jid`, `grp`);
ALTER TABLE `sr_user` ADD INDEX `i_sr_user_sh_grp` (`server_host`, `grp`); ALTER TABLE `sr_user` ADD INDEX `i_sr_user_sh_grp` (`server_host`, `grp`);
ALTER TABLE `sr_user` ADD PRIMARY KEY (`server_host`, `jid`, `grp`);
ALTER TABLE `muc_online_users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`; ALTER TABLE `muc_online_users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`;
ALTER TABLE `muc_online_users` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `muc_online_users` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `vcard` DROP PRIMARY KEY; ALTER TABLE `vcard` DROP PRIMARY KEY;

View File

@ -41,7 +41,9 @@
-- ALTER TABLE rostergroups ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE rostergroups ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE sr_group ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE sr_group ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_sr_group_name;
-- ALTER TABLE sr_group ADD PRIMARY KEY (server_host, name); -- ALTER TABLE sr_group ADD PRIMARY KEY (server_host, name);
-- CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group USING btree (server_host, name);
-- ALTER TABLE sr_group ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE sr_group ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE sr_user ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE sr_user ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
@ -153,6 +155,7 @@
-- DROP INDEX i_push_ut; -- DROP INDEX i_push_ut;
-- ALTER TABLE push_session ADD PRIMARY KEY (server_host, username, timestamp); -- ALTER TABLE push_session ADD PRIMARY KEY (server_host, username, timestamp);
-- CREATE UNIQUE INDEX i_push_session_susn ON push_session USING btree (server_host, username, service, node); -- CREATE UNIQUE INDEX i_push_session_susn ON push_session USING btree (server_host, username, service, node);
-- CREATE INDEX i_push_session_sh_username_timestamp ON push_session USING btree (server_host, username, timestamp);
-- ALTER TABLE push_session ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE push_session ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE mix_pam ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE mix_pam ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
@ -583,6 +586,7 @@ CREATE TABLE push_session (
); );
CREATE UNIQUE INDEX i_push_session_susn ON push_session USING btree (server_host, username, service, node); CREATE UNIQUE INDEX i_push_session_susn ON push_session USING btree (server_host, username, service, node);
CREATE INDEX i_push_session_sh_username_timestamp ON push_session USING btree (server_host, username, timestamp);
CREATE TABLE mix_channel ( CREATE TABLE mix_channel (
channel text NOT NULL, channel text NOT NULL,

View File

@ -403,7 +403,7 @@ CREATE TABLE push_session (
); );
CREATE UNIQUE INDEX i_push_usn ON push_session USING btree (username, service, node); CREATE UNIQUE INDEX i_push_usn ON push_session USING btree (username, service, node);
CREATE UNIQUE INDEX i_push_ut ON push_session USING btree (username, timestamp); CREATE INDEX i_push_ut ON push_session USING btree (username, timestamp);
CREATE TABLE mix_channel ( CREATE TABLE mix_channel (
channel text NOT NULL, channel text NOT NULL,