diff --git a/scripts/upgrade/sql/8.0.0/mysql/seafevents.sql b/scripts/upgrade/sql/8.0.0/mysql/seafevents.sql new file mode 100644 index 0000000..93a851b --- /dev/null +++ b/scripts/upgrade/sql/8.0.0/mysql/seafevents.sql @@ -0,0 +1,4 @@ +ALTER TABLE `VirusFile` ADD COLUMN IF NOT EXISTS `has_ignored` TINYINT(1) NOT NULL DEFAULT 0; +ALTER TABLE `VirusFile` CHANGE `has_handle` `has_deleted` TINYINT(1); +ALTER TABLE `VirusFile` ADD INDEX IF NOT EXISTS `has_deleted` (`has_deleted`); +ALTER TABLE `VirusFile` ADD INDEX IF NOT EXISTS `has_ignored` (`has_ignored`); diff --git a/scripts/upgrade/sql/8.0.0/mysql/seahub.sql b/scripts/upgrade/sql/8.0.0/mysql/seahub.sql index e4a2fc9..7ab51b3 100644 --- a/scripts/upgrade/sql/8.0.0/mysql/seahub.sql +++ b/scripts/upgrade/sql/8.0.0/mysql/seahub.sql @@ -37,8 +37,3 @@ CREATE TABLE IF NOT EXISTS `ocm_share_received` ( KEY `ocm_share_received_repo_id_9e77a1b9` (`repo_id`), KEY `ocm_share_received_provider_id_60c873e0` (`provider_id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `VirusFile` ADD COLUMN IF NOT EXISTS `has_ignored` TINYINT(1) NOT NULL DEFAULT 0; -ALTER TABLE `VirusFile` CHANGE `has_handle` `has_deleted` TINYINT(1); -ALTER TABLE `VirusFile` ADD INDEX IF NOT EXISTS `has_deleted` (`has_deleted`); -ALTER TABLE `VirusFile` ADD INDEX IF NOT EXISTS `has_ignored` (`has_ignored`); diff --git a/scripts/upgrade/sql/8.0.0/sqlite3/seafevents.sql b/scripts/upgrade/sql/8.0.0/sqlite3/seafevents.sql new file mode 100644 index 0000000..2bc1695 --- /dev/null +++ b/scripts/upgrade/sql/8.0.0/sqlite3/seafevents.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS "VirusFile_old"; +ALTER TABLE "VirusFile" RENAME TO "VirusFile_old"; +CREATE TABLE IF NOT EXISTS "VirusFile" ("vid" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "commit_id" varchar(40) NOT NULL, "file_path" text NOT NULL, "has_deleted" tinyint(1) NOT NULL, "has_ignored" TINYINT(1) NOT NULL DEFAULT 0); +INSERT INTO "VirusFile" ("vid", "repo_id", "commit_id", "file_path", "has_deleted") SELECT "vid", "repo_id", "commit_id", "file_path", "has_handle" FROM "VirusFile_old"; +DROP TABLE "VirusFile_old"; + +CREATE INDEX IF NOT EXISTS "VirusFile_repo_id_yewnci4gd" ON "VirusFile" ("repo_id"); +CREATE INDEX IF NOT EXISTS "VirusFile_has_deleted_834ndyts" ON "VirusFile" ("has_deleted"); +CREATE INDEX IF NOT EXISTS "VirusFile_has_ignored_d84tvuwg" ON "VirusFile" ("has_ignored"); diff --git a/scripts/upgrade/sql/8.0.0/sqlite3/seahub.sql b/scripts/upgrade/sql/8.0.0/sqlite3/seahub.sql index 65b9175..cc0ee70 100644 --- a/scripts/upgrade/sql/8.0.0/sqlite3/seahub.sql +++ b/scripts/upgrade/sql/8.0.0/sqlite3/seahub.sql @@ -10,13 +10,3 @@ CREATE INDEX IF NOT EXISTS "ocm_share_received_to_user_0921d09a" ON "ocm_share_r CREATE INDEX IF NOT EXISTS "ocm_share_received_from_server_url_10527b80" ON "ocm_share_received" ("from_server_url"); CREATE INDEX IF NOT EXISTS "ocm_share_received_repo_id_9e77a1b9" ON "ocm_share_received" ("repo_id"); CREATE INDEX IF NOT EXISTS "ocm_share_received_provider_id_60c873e0" ON "ocm_share_received" ("provider_id"); - -DROP TABLE IF EXISTS "VirusFile_old"; -ALTER TABLE "VirusFile" RENAME TO "VirusFile_old"; -CREATE TABLE IF NOT EXISTS "VirusFile" ("vid" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "commit_id" varchar(40) NOT NULL, "file_path" text NOT NULL, "has_deleted" tinyint(1) NOT NULL, "has_ignored" TINYINT(1) NOT NULL DEFAULT 0); -INSERT INTO "VirusFile" ("vid", "repo_id", "commit_id", "file_path", "has_deleted") SELECT "vid", "repo_id", "commit_id", "file_path", "has_handle" FROM "VirusFile_old"; -DROP TABLE "VirusFile_old"; - -CREATE INDEX IF NOT EXISTS "VirusFile_repo_id_yewnci4gd" ON "VirusFile" ("repo_id"); -CREATE INDEX IF NOT EXISTS "VirusFile_has_deleted_834ndyts" ON "VirusFile" ("has_deleted"); -CREATE INDEX IF NOT EXISTS "VirusFile_has_ignored_d84tvuwg" ON "VirusFile" ("has_ignored");