diff --git a/core/database/scripts/autobuild/db_00000.sql b/core/database/scripts/autobuild/db_00000.sql index f653dd81..690a0f5d 100644 --- a/core/database/scripts/autobuild/db_00000.sql +++ b/core/database/scripts/autobuild/db_00000.sql @@ -227,6 +227,8 @@ CREATE TABLE IF NOT EXISTS `search` ( DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE = MyISAM; +-- FULLTEXT search requires MyISAM and NOT InnoDB + DROP TABLE IF EXISTS `revision`; CREATE TABLE IF NOT EXISTS `revision` ( @@ -258,7 +260,8 @@ CREATE TABLE IF NOT EXISTS `config` ( `key` CHAR(255) NOT NULL, `config` JSON, UNIQUE INDEX `idx_config_area` (`key` ASC)) -DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin +ENGINE = InnoDB; INSERT INTO `config` VALUES ('SMTP','{\"userid\": \"\",\"password\": \"\",\"host\": \"\",\"port\": \"\",\"sender\": \"\"}'); INSERT INTO `config` VALUES ('FILEPLUGINS', diff --git a/core/database/scripts/autobuild/db_00015.sql b/core/database/scripts/autobuild/db_00015.sql index 43260e1e..57c3538b 100644 --- a/core/database/scripts/autobuild/db_00015.sql +++ b/core/database/scripts/autobuild/db_00015.sql @@ -44,6 +44,7 @@ CREATE TABLE IF NOT EXISTS `search` ( FULLTEXT INDEX `idx_search_content` (`content`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = MyISAM; +-- FULLTEXT search requires MyISAM and NOT InnoDB -- migrate page content INSERT INTO search (orgid, documentid, itemid, itemtype, content) SELECT orgid, documentid, id AS itemid, 'page' AS itemtype, TRIM(body) AS content FROM search_old; diff --git a/core/database/scripts/autobuild/db_00016.sql b/core/database/scripts/autobuild/db_00016.sql index 8a29dd42..3be35fcc 100644 --- a/core/database/scripts/autobuild/db_00016.sql +++ b/core/database/scripts/autobuild/db_00016.sql @@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `permission` ( UNIQUE INDEX `idx_permission_id` (`id` ASC), INDEX `idx_permission_orgid` (`orgid` ASC)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci -ENGINE = MyISAM; +ENGINE = InnoDB; CREATE INDEX idx_permission_1 ON permission(orgid,who,whoid,location); CREATE INDEX idx_permission_2 ON permission(orgid,who,whoid,location,action); @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `category` ( INDEX `idx_category_refid` (`refid` ASC), INDEX `idx_category_orgid` (`orgid` ASC)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci -ENGINE = MyISAM; +ENGINE = InnoDB; CREATE INDEX idx_category_1 ON category(orgid,labelid); @@ -63,12 +63,12 @@ CREATE TABLE IF NOT EXISTS `categorymember` ( UNIQUE INDEX `idx_categorymember_id` (`id` ASC), INDEX `idx_category_documentid` (`documentid`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci -ENGINE = MyISAM; +ENGINE = InnoDB; CREATE INDEX idx_categorymember_1 ON categorymember(orgid,documentid); CREATE INDEX idx_categorymember_2 ON categorymember(orgid,labelid); --- rolee represent user groups +-- rolee represent user groups DROP TABLE IF EXISTS `role`; CREATE TABLE IF NOT EXISTS `role` ( @@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS `role` ( INDEX `idx_category_refid` (`refid` ASC), INDEX `idx_category_orgid` (`orgid` ASC)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci -ENGINE = MyISAM; +ENGINE = InnoDB; -- role member records user role membership DROP TABLE IF EXISTS `rolemember`; @@ -93,49 +93,49 @@ CREATE TABLE IF NOT EXISTS `rolemember` ( `userid` CHAR(16) NOT NULL COLLATE utf8_bin, UNIQUE INDEX `idx_category_id` (`id` ASC)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci -ENGINE = MyISAM; +ENGINE = InnoDB; CREATE INDEX idx_rolemember_1 ON rolemember(roleid,userid); CREATE INDEX idx_rolemember_2 ON rolemember(orgid,roleid,userid); -- user account can have global permssion to state if user can see all other users --- provides granular control for external users +-- provides granular control for external users ALTER TABLE account ADD COLUMN `users` BOOL NOT NULL DEFAULT 1 AFTER `admin`; -- migrate space/document permissions -- space own -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'own' as `action`, 'object' as scope, 'space' as location, refid FROM label; -- space manage (same as owner) -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'manage' as `action`, 'object' as scope, 'space' as location, refid FROM label; -- view space -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'view' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canview=1; -- edit space => add/edit/delete/move/copy/template documents -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-add' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-edit' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-delete' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-move' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-copy' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; -INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) +INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid) SELECT orgid, 'user' as who, userid as whois, 'doc-template' as `action`, 'object' as scope, 'space' as location, labelid as refid FROM labelrole WHERE canedit=1; diff --git a/core/database/scripts/autobuild/db_00020.sql b/core/database/scripts/autobuild/db_00020.sql index 54489713..18a5ba8e 100644 --- a/core/database/scripts/autobuild/db_00020.sql +++ b/core/database/scripts/autobuild/db_00020.sql @@ -1,5 +1,13 @@ /* enterprise edition */ +-- consistency of table engines +ALTER TABLE config ENGINE = InnoDB; +ALTER TABLE permission ENGINE = InnoDB; +ALTER TABLE category ENGINE = InnoDB; +ALTER TABLE categorymember ENGINE = InnoDB; +ALTER TABLE role ENGINE = InnoDB; +ALTER TABLE rolemember ENGINE = InnoDB; + -- content analytics ALTER TABLE useractivity ADD COLUMN `metadata` VARCHAR(1000) NOT NULL DEFAULT '' AFTER `activitytype`; @@ -21,7 +29,7 @@ ALTER TABLE useractivity ADD COLUMN `metadata` VARCHAR(1000) NOT NULL DEFAULT '' -- INDEX `idx_vote_documentid` (`documentid` ASC), -- INDEX `idx_vote_orgid` (`orgid` ASC)) -- DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci --- ENGINE = MyISAM; +-- ENGINE = InnoDB; -- CREATE INDEX idx_vote_1 ON vaote(orgid,documentid);