-
Notifications
You must be signed in to change notification settings - Fork 5
/
schema.sql
339 lines (311 loc) · 11.6 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
CREATE TABLE `group_members` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_id` int(10) unsigned NOT NULL DEFAULT '0',
`user_id` int(10) unsigned NOT NULL DEFAULT '0',
`added_by` varchar(30) NOT NULL DEFAULT '',
`added_time` int(11) unsigned NOT NULL DEFAULT '0',
`reason` varchar(255) DEFAULT NULL,
`level` tinyint(3) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `id` (`id`),
KEY `user_id` (`user_id`),
KEY `group_id` (`group_id`)
);
CREATE TABLE `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`gdesc` varchar(255) NOT NULL DEFAULT '',
`owner` int(11) NOT NULL DEFAULT '0',
`flags` int(11) NOT NULL DEFAULT '0',
`isteam` tinyint(1) NOT NULL DEFAULT '0',
`private_actions` tinyint(1) NOT NULL DEFAULT '0',
`iskarnaf` tinyint(1) NOT NULL DEFAULT '0',
`autoforward` TEXT DEFAULT NULL,
`assign_msg` TEXT DEFAULT NULL,
`set_private` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_actions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) NOT NULL DEFAULT '0',
`is_private` tinyint(1) NOT NULL DEFAULT '0',
`a_type` smallint(6) NOT NULL DEFAULT '0',
`action` text NOT NULL,
`a_time` bigint(20) NOT NULL DEFAULT '0',
`a_by_u` text NOT NULL,
`a_by_g` text NOT NULL,
PRIMARY KEY (`id`),
KEY `tid` (`tid`)
);
CREATE TABLE `karnaf_cat1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_cat2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '0',
`parent` int(11) NOT NULL DEFAULT '0',
`allowed_group` text,
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_cat3` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '0',
`parent` int(11) NOT NULL DEFAULT '0',
`default_priority` int(11) NOT NULL DEFAULT '0',
`default_group` text NOT NULL,
`extra` text,
`allowed_group` text,
`keywords` text NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_memo_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tonick` varchar(30) DEFAULT NULL,
`memo` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_priorities` (
`priority_id` int(11) NOT NULL DEFAULT '0',
`priority_name` text NOT NULL
);
CREATE TABLE `karnaf_replies` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) NOT NULL DEFAULT '0',
`title` varchar(250) DEFAULT NULL,
`reply` text NOT NULL,
`r_time` bigint(20) NOT NULL DEFAULT '0',
`r_by` varchar(50) NOT NULL DEFAULT '',
`r_from` varchar(250) NOT NULL DEFAULT '',
`ip` varchar(74) DEFAULT NULL,
`message_id` varchar(250) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tid` (`tid`)
);
CREATE TABLE `karnaf_statuses` (
`status_id` int(11) NOT NULL DEFAULT '0',
`status_name` text NOT NULL,
`is_closed` tinyint(1) NOT NULL DEFAULT '0',
`ttl` varchar(250) NOT NULL DEFAULT '',
`ttl_status` int(11) NOT NULL DEFAULT '0',
`priority` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`status_id`)
);
CREATE TABLE `karnaf_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL DEFAULT '0',
`subject` varchar(250) NOT NULL DEFAULT '',
`body` text NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_tickets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`randcode` varchar(20) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '1',
`title` varchar(250) DEFAULT NULL,
`description` text NOT NULL,
`cat3_id` int(11) NOT NULL DEFAULT '0',
`unick` varchar(30) NOT NULL DEFAULT '',
`ufullname` varchar(250) NOT NULL DEFAULT '',
`uemail` varchar(250) NOT NULL DEFAULT '',
`uphone` varchar(250) NOT NULL DEFAULT '',
`ulocation` varchar(250) NOT NULL DEFAULT '',
`uip` varchar(16) NOT NULL DEFAULT '',
`upriority` int(11) NOT NULL DEFAULT '0',
`priority` int(11) NOT NULL DEFAULT '0',
`open_time` bigint(14) DEFAULT NULL,
`close_time` bigint(14) DEFAULT NULL,
`opened_by` text NOT NULL,
`rep_u` varchar(30) NOT NULL DEFAULT '',
`rep_g` varchar(30) NOT NULL DEFAULT '',
`rep_cc` varchar(30) NOT NULL DEFAULT '',
`closed_by` varchar(30) NOT NULL DEFAULT '',
`is_real` tinyint(1) NOT NULL DEFAULT '0',
`is_private` tinyint(1) NOT NULL DEFAULT '0',
`email_upd` tinyint(1) NOT NULL DEFAULT '0',
`memo_upd` tinyint(1) NOT NULL DEFAULT '0',
`ext1` varchar(250) DEFAULT NULL,
`ext2` varchar(250) DEFAULT NULL,
`ext3` varchar(250) DEFAULT NULL,
`merged_to` int(11) NOT NULL DEFAULT '0',
`cc` varchar(250) DEFAULT NULL,
`lastupd_time` bigint(14) DEFAULT NULL,
`message_id` varchar(250) DEFAULT NULL,
`last_note` text DEFAULT NULL,
`newuserreply` tinyint(1) NOT NULL DEFAULT '0',
`escalation` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `rep_u` (`rep_u`),
KEY `status` (`status`),
KEY `karnaf_tickets_unick` (`unick`),
KEY `karnaf_tickets_uemail` (`uemail`),
KEY `karnaf_tickets_rep_g` (`rep_g`),
KEY `karnaf_tickets_ext1` (`ext1`),
KEY `karnaf_tickets_merged_to` (`merged_to`)
);
CREATE TABLE `mail_queue` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`mail_to` varchar(250) DEFAULT NULL,
`mail_from` varchar(250) DEFAULT NULL,
`mail_subject` varchar(250) DEFAULT NULL,
`mail_body` text,
PRIMARY KEY (`id`)
);
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL auto_increment,
`user` varchar(30) NOT NULL,
`pass` varchar(65) NOT NULL default '',
`email` varchar(250) default NULL,
`url` varchar(250) default NULL,
`regtime` int(11) default NULL,
`lasttime` int(11) default NULL,
`lastseen_ip` varchar(15) NOT NULL default '',
`operlev` tinyint(4) NOT NULL default '0',
`flags` int(10) unsigned NOT NULL default '0',
`options` int(10) unsigned NOT NULL default '0',
`lasthost` varchar(255) default NULL,
`timezone` int(11) default NULL,
`avatar` varchar(30) default NULL,
`signature` text,
`newemail` varchar(250) default NULL,
`fullname` varchar(250) default NULL,
`fname` varchar(250) default NULL,
`lname` varchar(250) default NULL,
`department` varchar(250) default NULL,
`team` varchar(250) default NULL,
`title` varchar(250) default NULL,
`phone` varchar(250) default NULL,
`room` varchar(250) default NULL,
`lastsync` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `user` (`user`)
);
CREATE TABLE `ws_logs` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`date` int(32) NOT NULL DEFAULT '0',
`action` text,
`user` varchar(255) DEFAULT NULL,
`logtype` varchar(255) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL
);
CREATE TABLE `karnaf_mail_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) NOT NULL DEFAULT '0',
`type` tinyint(1) NOT NULL DEFAULT '0',
`host` varchar(250) NOT NULL DEFAULT '',
`port` varchar(250) NOT NULL DEFAULT '',
`user` varchar(250) NOT NULL DEFAULT '',
`pass` varchar(250) NOT NULL DEFAULT '',
`cat3_id` int(11) NOT NULL DEFAULT '0',
`default_group` text NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_ldap_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) NOT NULL DEFAULT '0',
`type` tinyint(1) NOT NULL DEFAULT '0',
`host` varchar(250) NOT NULL DEFAULT '',
`user` varchar(250) NOT NULL DEFAULT '',
`pass` varchar(250) NOT NULL DEFAULT '',
`ou` text NOT NULL,
`filter` text NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_files` (
`id` int(11) NOT NULL auto_increment,
`tid` int(11) NOT NULL default '0',
`file_name` varchar(250) NOT NULL,
`file_type` varchar(50) NOT NULL,
`file_desc` varchar(250) NOT NULL,
`file_path` varchar(250) NOT NULL,
`file_size` int(11) NOT NULL,
`lastupd_time` int(11) default NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_mail_rules` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '',
`active` tinyint(1) NOT NULL DEFAULT '0',
`priority` int(11) NOT NULL DEFAULT '0',
`rcpt_pattern` varchar(250) NOT NULL DEFAULT '',
`to_pattern` varchar(250) NOT NULL DEFAULT '',
`cc_pattern` varchar(250) NOT NULL DEFAULT '',
`subject_pattern` varchar(250) NOT NULL DEFAULT '',
`body_pattern` varchar(250) NOT NULL DEFAULT '',
`stop_duplicates` tinyint(1) NOT NULL DEFAULT '0',
`break` tinyint(1) NOT NULL DEFAULT '0',
`set_priority` int(11) NOT NULL DEFAULT '0',
`set_group` varchar(30) DEFAULT NULL,
`set_extra` varchar(250) DEFAULT NULL,
`set_cat3` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_debug` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) NOT NULL DEFAULT '0',
`body` text NOT NULL,
PRIMARY KEY (`id`),
KEY `tid` (`tid`)
);
CREATE TABLE `karnaf_sms_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) NOT NULL DEFAULT '0',
`type` tinyint(1) NOT NULL DEFAULT '0',
`account_id` varchar(250) NOT NULL DEFAULT '',
`account_token` varchar(250) NOT NULL DEFAULT '',
`from_number` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_filters` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`tooltip` varchar(255) NOT NULL DEFAULT '',
`querystr` TEXT NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
CREATE TABLE `karnaf_watching` (
`tid` int(11) NOT NULL,
`user` varchar(30) NOT NULL DEFAULT '',
`fullname` varchar(250) NOT NULL DEFAULT '',
`timestamp` bigint(14) DEFAULT NULL,
KEY `tid` (`tid`)
);
CREATE TABLE `karnaf_schema` (
`version` varchar(30) NOT NULL DEFAULT ''
);
INSERT INTO `karnaf_schema` VALUES ('1');
INSERT INTO `karnaf_schema` VALUES ('2');
INSERT INTO `karnaf_schema` VALUES ('3');
INSERT INTO `karnaf_schema` VALUES ('4');
INSERT INTO `karnaf_schema` VALUES ('5');
INSERT INTO `karnaf_schema` VALUES ('6');
INSERT INTO `karnaf_schema` VALUES ('7');
INSERT INTO `karnaf_schema` VALUES ('8');
INSERT INTO `karnaf_schema` VALUES ('9');
INSERT INTO `karnaf_schema` VALUES ('10');
INSERT INTO `karnaf_schema` VALUES ('11');
INSERT INTO `karnaf_schema` VALUES ('12');
INSERT INTO `karnaf_schema` VALUES ('13');
INSERT INTO `karnaf_schema` VALUES ('14');
INSERT INTO `karnaf_schema` VALUES ('15');
INSERT INTO `karnaf_schema` VALUES ('16');
INSERT INTO `karnaf_priorities` VALUES (-1,'Low');
INSERT INTO `karnaf_priorities` VALUES (0,'Normal');
INSERT INTO `karnaf_priorities` VALUES (10,'Above Normal');
INSERT INTO `karnaf_priorities` VALUES (20,'High');
INSERT INTO `karnaf_priorities` VALUES (30,'Critical');
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (0,'Closed',1,0);
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (1,'Opened',0,1);
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (2,'Opened - Waiting for user reply',0,2);
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (3,'Held',0,3);
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (4,'Held - Possible spam',0,4);
INSERT INTO karnaf_statuses(status_id,status_name,is_closed,priority) VALUES (5,'Spam',1,5);
INSERT INTO `users`(id,user,pass,email,url,regtime,lasttime,lastseen_ip,operlev,flags,options,lasthost,title) VALUES (1,'admin','098f6bcd4621d373cade4e832627b4f6','[email protected]','',1426820239,1427066785,'',80,0,0,'127.0.0.1','System Administrator');
INSERT INTO groups(name,gdesc,iskarnaf) VALUES('karnaf-admins', 'Karnaf Admins', 1);
INSERT INTO groups(name,gdesc,iskarnaf) VALUES('karnaf-opers', 'Karnaf Operators', 1);
INSERT INTO group_members(group_id,user_id,level) VALUES((SELECT id FROM groups WHERE name='karnaf-admins'), (SELECT id FROM users WHERE user='admin'), 30);