Skip to content

Commit

Permalink
update 11.0 sql (#5762)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkywalkerSpace authored Nov 14, 2023
1 parent aa3c031 commit c686288
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
21 changes: 21 additions & 0 deletions scripts/upgrade/sql/11.0.0/mysql/seahub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ CREATE TABLE IF NOT EXISTS `deleted_files_count` (
KEY `ix_deleted_files_count_deleted_time` (`deleted_time`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `sdoc_notification` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`doc_uuid` varchar(36) NOT NULL,
`username` varchar(255) NOT NULL,
`msg_type` varchar(36) NOT NULL,
`created_at` datetime NOT NULL,
`detail` longtext NOT NULL,
`seen` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `sdoc_notification_doc_uuid_username` (`doc_uuid`, `username`),
KEY `sdoc_notification_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `share_uploadlinkshare` ADD INDEX IF NOT EXISTS `share_uploadlinkshare_expire_date` (`expire_date`);

ALTER TABLE share_fileshare MODIFY COLUMN path longtext NOT NULL COLLATE utf8mb4_bin;

ALTER TABLE options_useroptions MODIFY option_val VARCHAR(512) NOT NULL;

ALTER TABLE `org_saml_config` CHANGE domain domain varchar(255) DEFAULT NULL;
ALTER TABLE `org_saml_config` ADD COLUMN IF NOT EXISTS `dns_txt` varchar(64) NULL;
ALTER TABLE `org_saml_config` ADD COLUMN IF NOT EXISTS `domain_verified` TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE `org_saml_config` ADD INDEX IF NOT EXISTS `org_saml_config_domain_verified_398065b9` (`domain_verified`);
UPDATE `org_saml_config` SET domain_verified=1 WHERE domain_verified=0;
18 changes: 18 additions & 0 deletions scripts/upgrade/sql/11.0.0/sqlite3/seahub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ CREATE INDEX IF NOT EXISTS "ix_deleted_files_count_repo_id" ON "deleted_files_co
CREATE INDEX IF NOT EXISTS "ix_deleted_files_count_deleted_time" ON "deleted_files_count" ("deleted_time");

CREATE INDEX IF NOT EXISTS "share_uploadlinkshare_expire_date" ON "share_uploadlinkshare" ("expire_date");

CREATE TABLE IF NOT EXISTS "sdoc_notification" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "doc_uuid" varchar(36) NOT NULL UNIQUE, "username" varchar(255) NOT NULL, "msg_type" varchar(36) NOT NULL, "created_at" datetime NOT NULL, "detail" text NOT NULL, "seen" integer NOT NULL DEFAULT 0);
CREATE INDEX IF NOT EXISTS "sdoc_notification_doc_uuid_username" ON "sdoc_notification" ("doc_uuid", "username");
CREATE INDEX IF NOT EXISTS "sdoc_notification_created_at" ON "sdoc_notification" ("created_at");

DROP TABLE IF EXISTS "options_useroptions_old";
ALTER TABLE "options_useroptions" RENAME TO "options_useroptions_old";
CREATE TABLE IF NOT EXISTS "options_useroptions" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(255) NOT NULL, "option_val" varchar(512) NOT NULL, "option_key" varchar(50) NOT NULL);
INSERT INTO "options_useroptions" ("email", "option_val", "option_key") SELECT "email", "option_val", "option_key" FROM "options_useroptions_old";
DROP TABLE "options_useroptions_old";

DROP TABLE IF EXISTS "org_saml_config_old";
ALTER TABLE "org_saml_config" RENAME TO "org_saml_config_old";
CREATE TABLE IF NOT EXISTS "org_saml_config" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "org_id" integer NOT NULL UNIQUE, "metadata_url" TEXT NOT NULL, "domain" varchar(255) NULL UNIQUE, "dns_txt" varchar(64) NULL, "domain_verified" integer NOT NULL DEFAULT 0);
CREATE INDEX IF NOT EXISTS "org_saml_config_domain_verified_398065b9" ON "org_saml_config" ("domain_verified");
INSERT INTO "org_saml_config" ("org_id", "metadata_url", "domain") SELECT "org_id", "metadata_url", "domain" FROM "org_saml_config_old";
UPDATE `org_saml_config` SET domain_verified=1 WHERE domain_verified=0;
DROP TABLE "org_saml_config_old";
9 changes: 6 additions & 3 deletions sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ CREATE TABLE `options_useroptions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`option_key` varchar(50) NOT NULL,
`option_val` varchar(50) NOT NULL,
`option_val` varchar(512) NOT NULL,
PRIMARY KEY (`id`),
KEY `options_useroptions_email_77d5726a` (`email`),
KEY `options_useroptions_option_key_7bf7ae4b` (`option_key`)
Expand Down Expand Up @@ -1350,10 +1350,13 @@ CREATE TABLE `org_saml_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`org_id` int(11) NOT NULL,
`metadata_url` longtext NOT NULL,
`domain` varchar(255) NOT NULL,
`domain` varchar(255) DEFAULT NULL,
`dns_txt` varchar(64) DEFAULT NULL,
`domain_verified` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `org_id` (`org_id`),
UNIQUE KEY `domain` (`domain`)
UNIQUE KEY `domain` (`domain`),
KEY `org_saml_config_domain_verified_398065b9` (`domain_verified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `base_usermonitoredrepos` (
Expand Down
8 changes: 6 additions & 2 deletions sql/sqlite3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ CREATE TABLE "invitations_invitation" ("id" integer NOT NULL PRIMARY KEY AUTOINC
CREATE TABLE "repo_share_invitation" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "permission" varchar(50) NOT NULL, "invitation_id" integer NOT NULL REFERENCES "invitations_invitation" ("id"));
CREATE TABLE "notifications_notification" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "message" varchar(512) NOT NULL, "primary" bool NOT NULL);
CREATE TABLE "notifications_usernotification" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "to_user" varchar(255) NOT NULL, "msg_type" varchar(30) NOT NULL, "detail" text NOT NULL, "seen" bool NOT NULL, "timestamp" datetime NOT NULL);
CREATE TABLE "options_useroptions" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(255) NOT NULL, "option_val" varchar(50) NOT NULL, "option_key" varchar(50) NOT NULL);
CREATE TABLE "options_useroptions" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(255) NOT NULL, "option_val" varchar(512) NOT NULL, "option_key" varchar(50) NOT NULL);
CREATE TABLE "organizations_orgmemberquota" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "org_id" integer NOT NULL, "quota" integer NOT NULL);
CREATE TABLE "organizations_orgsettings" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "role" varchar(100) NULL, "org_id" integer NOT NULL UNIQUE);
CREATE TABLE "post_office_attachment_emails" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "attachment_id" integer NOT NULL REFERENCES "post_office_attachment" ("id"), "email_id" integer NOT NULL REFERENCES "post_office_email" ("id"));
Expand Down Expand Up @@ -616,7 +616,8 @@ CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_shared_by_1786d580" ON
CREATE TABLE IF NOT EXISTS "onlyoffice_onlyofficedockey" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "doc_key" varchar(36) NOT NULL, "username" varchar(255) NOT NULL, "repo_id" varchar(36) NULL, "file_path" TEXT NOT NULL, "repo_id_file_path_md5" varchar(100) NOT NULL, "created_time" datetime NOT NULL);
CREATE INDEX IF NOT EXISTS "onlyoffice_onlyofficedockey_doc_key_edba1352" ON "onlyoffice_onlyofficedockey" ("doc_key");
CREATE INDEX IF NOT EXISTS "onlyoffice_onlyofficedockey_repo_id_file_path_md5_52002073" ON "onlyoffice_onlyofficedockey" ("repo_id_file_path_md5");
CREATE TABLE IF NOT EXISTS "org_saml_config" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "org_id" integer NOT NULL UNIQUE, "metadata_url" TEXT NOT NULL, "domain" varchar(255) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "org_saml_config" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "org_id" integer NOT NULL UNIQUE, "metadata_url" TEXT NOT NULL, "domain" varchar(255) NULL UNIQUE, "dns_txt" varchar(64) NULL, "domain_verified" integer NOT NULL DEFAULT 0);
CREATE INDEX IF NOT EXISTS "org_saml_config_domain_verified_398065b9" ON "org_saml_config" ("domain_verified");
CREATE TABLE IF NOT EXISTS "base_usermonitoredrepos" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(254) NOT NULL, "repo_id" varchar(36) NOT NULL, "timestamp" datetime NOT NULL, UNIQUE ("email", "repo_id"));
CREATE INDEX IF NOT EXISTS "base_usermonitoredrepos_email_55ead1b9" ON "base_usermonitoredrepos" ("email");
CREATE INDEX IF NOT EXISTS "base_usermonitoredrepos_repo_id_00e624c3" ON "base_usermonitoredrepos" ("repo_id");
Expand All @@ -638,4 +639,7 @@ CREATE INDEX IF NOT EXISTS "sdoc_comment_reply_doc_uuid" ON "sdoc_comment_reply"
CREATE TABLE IF NOT EXISTS "deleted_files_count" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "deleted_time" datetime NOT NULL, "files_count" bigint NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_deleted_files_count_repo_id" ON "deleted_files_count" ("repo_id");
CREATE INDEX IF NOT EXISTS "ix_deleted_files_count_deleted_time" ON "deleted_files_count" ("deleted_time");
CREATE TABLE IF NOT EXISTS "sdoc_notification" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "doc_uuid" varchar(36) NOT NULL UNIQUE, "username" varchar(255) NOT NULL, "msg_type" varchar(36) NOT NULL, "created_at" datetime NOT NULL, "detail" text NOT NULL, "seen" integer NOT NULL DEFAULT 0);
CREATE INDEX IF NOT EXISTS "sdoc_notification_doc_uuid_username" ON "sdoc_notification" ("doc_uuid", "username");
CREATE INDEX IF NOT EXISTS "sdoc_notification_created_at" ON "sdoc_notification" ("created_at");
COMMIT;

0 comments on commit c686288

Please sign in to comment.