@@ -24,6 +24,11 @@ CREATE TABLE IF NOT EXISTS `permission` (
24
24
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
25
25
ENGINE = MyISAM;
26
26
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
+
27
32
-- category represents "folder/label/category" assignment to document (1:M)
28
33
DROP TABLE IF EXISTS ` category` ;
29
34
@@ -41,6 +46,8 @@ CREATE TABLE IF NOT EXISTS `category` (
41
46
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
42
47
ENGINE = MyISAM;
43
48
49
+ CREATE INDEX idx_category_1 ON category(orgid,labelid);
50
+
44
51
-- category member records who can see a category and the documents within
45
52
DROP TABLE IF EXISTS ` categorymember` ;
46
53
@@ -58,6 +65,9 @@ CREATE TABLE IF NOT EXISTS `categorymember` (
58
65
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
59
66
ENGINE = MyISAM;
60
67
68
+ CREATE INDEX idx_categorymember_1 ON categorymember(orgid,documentid);
69
+ CREATE INDEX idx_categorymember_2 ON categorymember(orgid,labelid);
70
+
61
71
-- rolee represent user groups
62
72
DROP TABLE IF EXISTS ` role` ;
63
73
@@ -85,6 +95,9 @@ CREATE TABLE IF NOT EXISTS `rolemember` (
85
95
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
86
96
ENGINE = MyISAM;
87
97
98
+ CREATE INDEX idx_rolemember_1 ON rolemember(roleid,userid);
99
+ CREATE INDEX idx_rolemember_2 ON rolemember(orgid,roleid,userid);
100
+
88
101
-- user account can have global permssion to state if user can see all other users
89
102
-- provides granular control for external users
90
103
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)
126
139
SELECT orgid, ' user' as who, userid as whois, ' doc-template' as ` action` , ' object' as scope, ' space' as location, labelid as refid
127
140
FROM labelrole WHERE canedit= 1 ;
128
141
142
+ -- everyone users ID changed to 0
143
+ UPDATE permission SET whoid= ' 0' WHERE whoid= ' ' ;
0 commit comments