Skip to content

Commit bc72db7

Browse files
committed
added sql indexes
1 parent 82c381d commit bc72db7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/database/scripts/autobuild/db_00016.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ CREATE TABLE IF NOT EXISTS `permission` (
2424
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
2525
ENGINE = MyISAM;
2626

27+
CREATE INDEX idx_permission_1 ON permission(orgid,who,whoid,location);
28+
CREATE INDEX idx_permission_2 ON permission(orgid,who,whoid,location,action);
29+
CREATE INDEX idx_permission_3 ON permission(orgid,location,refid);
30+
CREATE INDEX idx_permission_4 ON permission(orgid,who,location,action);
31+
2732
-- category represents "folder/label/category" assignment to document (1:M)
2833
DROP TABLE IF EXISTS `category`;
2934

@@ -41,6 +46,8 @@ CREATE TABLE IF NOT EXISTS `category` (
4146
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
4247
ENGINE = MyISAM;
4348

49+
CREATE INDEX idx_category_1 ON category(orgid,labelid);
50+
4451
-- category member records who can see a category and the documents within
4552
DROP TABLE IF EXISTS `categorymember`;
4653

@@ -58,6 +65,9 @@ CREATE TABLE IF NOT EXISTS `categorymember` (
5865
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
5966
ENGINE = MyISAM;
6067

68+
CREATE INDEX idx_categorymember_1 ON categorymember(orgid,documentid);
69+
CREATE INDEX idx_categorymember_2 ON categorymember(orgid,labelid);
70+
6171
-- rolee represent user groups
6272
DROP TABLE IF EXISTS `role`;
6373

@@ -85,6 +95,9 @@ CREATE TABLE IF NOT EXISTS `rolemember` (
8595
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
8696
ENGINE = MyISAM;
8797

98+
CREATE INDEX idx_rolemember_1 ON rolemember(roleid,userid);
99+
CREATE INDEX idx_rolemember_2 ON rolemember(orgid,roleid,userid);
100+
88101
-- user account can have global permssion to state if user can see all other users
89102
-- provides granular control for external users
90103
ALTER TABLE account ADD COLUMN `users` BOOL NOT NULL DEFAULT 1 AFTER `admin`;
@@ -126,3 +139,5 @@ INSERT INTO permission (orgid, who, whoid, `action`, scope, location, refid)
126139
SELECT orgid, 'user' as who, userid as whois, 'doc-template' as `action`, 'object' as scope, 'space' as location, labelid as refid
127140
FROM labelrole WHERE canedit=1;
128141

142+
-- everyone users ID changed to 0
143+
UPDATE permission SET whoid='0' WHERE whoid='';

0 commit comments

Comments
 (0)