forked from bayousoft/phplist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phplist.sql
635 lines (520 loc) · 16.8 KB
/
phplist.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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
begin;
set search_path to phplist;
CREATE TABLE eventlog (
id serial NOT NULL,
entered timestamp NULL default NULL,
page varchar(100) NULL default NULL,
entry text,
PRIMARY KEY (id)
);
CREATE TABLE keymanager_keydata (
name varchar(255) NOT NULL default '',
id integer NOT NULL,
data text,
PRIMARY KEY (name,id)
);
CREATE TABLE keymanager_keys (
id serial NOT NULL,
keyid varchar(255) NOT NULL,
email varchar(255) NULL default NULL,
name varchar(255) NULL default NULL,
fingerprint varchar(255) NULL default NULL,
can_encrypt integer NULL default NULL,
can_sign integer NULL default NULL,
deleted integer default '0',
PRIMARY KEY (id)
);
CREATE TABLE phplist_admin (
id serial NOT NULL,
loginname varchar(25) NOT NULL default '',
namelc varchar(255) NULL default NULL,
email varchar(255) NOT NULL default '',
created timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
modifiedby varchar(25) NULL default NULL,
password varchar(255) NULL default NULL,
passwordchanged date NULL default NULL,
superuser integer default '0',
disabled integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX loginname ON phplist_admin (loginname );
CREATE TABLE phplist_admin_attribute (
adminattributeid integer NOT NULL default '0',
adminid integer NOT NULL default '0',
value varchar(255) NULL default NULL,
PRIMARY KEY (adminattributeid,adminid)
);
CREATE TABLE phplist_admin_task (
adminid integer NOT NULL default '0',
taskid integer NOT NULL default '0',
level integer NULL default NULL,
PRIMARY KEY (adminid,taskid)
);
CREATE TABLE phplist_adminattribute (
id serial NOT NULL,
name varchar(255) NOT NULL default '',
type varchar(30) NULL default NULL,
listorder integer NULL default NULL,
default_value varchar(255) NULL default NULL,
required integer NULL default NULL,
tablename varchar(255) NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_attachment (
id serial NOT NULL,
filename varchar(255) NULL default NULL,
remotefile varchar(255) NULL default NULL,
mimetype varchar(255) NULL default NULL,
description text,
size integer NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_bounce (
id serial NOT NULL,
date timestamp NULL default NULL,
header text,
data bytea,
status varchar(255) NULL default NULL,
comment text,
PRIMARY KEY (id)
);
CREATE INDEX dateindex ON phplist_bounce (date);
CREATE TABLE phplist_bounceregex (
id serial NOT NULL,
regex varchar(255) NULL default NULL,
action varchar(255) NULL default NULL,
listorder integer default '0',
admin integer NULL default NULL,
comment text,
status varchar(255) NULL default NULL,
count integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX regex ON phplist_bounceregex (regex);
CREATE TABLE phplist_bounceregex_bounce (
regex integer NOT NULL default '0',
bounce integer NOT NULL default '0',
PRIMARY KEY (regex,bounce)
);
CREATE TABLE phplist_config (
item varchar(35) NOT NULL default '',
value text,
editable integer default '1',
type varchar(25) NULL default NULL,
PRIMARY KEY (item)
);
CREATE TABLE phplist_eventlog (
id serial NOT NULL,
entered timestamp NULL default NULL,
page varchar(100) NULL default NULL,
entry text,
PRIMARY KEY (id)
);
CREATE TABLE phplist_linktrack (
linkid serial NOT NULL,
messageid integer NOT NULL default '0',
userid integer NOT NULL default '0',
url varchar(255) NULL default NULL,
forward text,
firstclick timestamp NULL default NULL,
latestclick timestamp NOT NULL default CURRENT_TIMESTAMP,
clicked integer default '0',
PRIMARY KEY (linkid)
);
CREATE UNIQUE INDEX messageid_lt ON phplist_linktrack (messageid, userid, url);
CREATE INDEX miduidurlindex ON phplist_linktrack (messageid, userid, url);
CREATE TABLE phplist_linktrack_forward (
id serial NOT NULL,
url varchar(255) NULL default NULL,
personalise integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX ulrunique ON phplist_linktrack_forward (url);
CREATE INDEX urlindex_forward ON phplist_linktrack_forward (url);
CREATE TABLE phplist_linktrack_ml (
messageid integer NOT NULL,
forwardid integer NOT NULL,
firstclick timestamp NULL default NULL,
latestclick timestamp NULL default NULL,
total integer default '0',
clicked integer default '0',
htmlclicked integer default '0',
textclicked integer default '0',
PRIMARY KEY (messageid,forwardid)
);
CREATE INDEX midindex ON phplist_linktrack_ml (messageid);
CREATE INDEX fwdindex ON phplist_linktrack_ml (forwardid);
CREATE TABLE phplist_linktrack_uml_click (
id serial NOT NULL,
messageid integer NOT NULL,
userid integer NOT NULL,
forwardid integer NULL default NULL,
firstclick timestamp NULL default NULL,
latestclick timestamp NULL default NULL,
clicked integer default '0',
htmlclicked integer default '0',
textclicked integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX miduidfwdid ON phplist_linktrack_uml_click (messageid, userid, forwardid);
CREATE INDEX midindex_uml ON phplist_linktrack_uml_click (messageid);
CREATE INDEX uidindex ON phplist_linktrack_uml_click (userid);
CREATE INDEX miduidindex ON phplist_linktrack_uml_click (messageid, userid);
CREATE TABLE phplist_linktrack_userclick (
linkid integer NOT NULL default '0',
userid integer NOT NULL default '0',
messageid integer NOT NULL default '0',
name varchar(255) NULL default NULL,
data text,
date timestamp NULL default NULL
);
CREATE INDEX linkusermessageindex ON phplist_linktrack_userclick (linkid, userid, messageid);
CREATE TABLE phplist_list (
id serial NOT NULL,
name varchar(255) NOT NULL default '',
description text,
entered timestamp NULL default NULL,
listorder integer NULL default NULL,
prefix varchar(10) NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
active integer NULL default NULL,
owner integer NULL default NULL,
rssfeed varchar(255) NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_listattr_bpleaseche (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_bpl ON phplist_listattr_bpleaseche (name);
CREATE TABLE phplist_listattr_bwheredoyo (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_bwh ON phplist_listattr_bwheredoyo (name);
CREATE TABLE phplist_listattr_cbgroup (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_cbg ON phplist_listattr_cbgroup (name);
CREATE TABLE phplist_listattr_comments (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_ltr ON phplist_listattr_comments (name);
CREATE TABLE phplist_listattr_countries (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lac ON phplist_listattr_countries (name);
CREATE TABLE phplist_listattr_hiddenfiel (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lah ON phplist_listattr_hiddenfiel (name);
CREATE TABLE phplist_listattr_iagreewith (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lai ON phplist_listattr_iagreewith (name);
CREATE TABLE phplist_listattr_most (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lam ON phplist_listattr_most (name);
CREATE TABLE phplist_listattr_othercomme (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lao ON phplist_listattr_othercomme (name);
CREATE TABLE phplist_listattr_publickey (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_lap ON phplist_listattr_publickey (name);
CREATE TABLE phplist_listattr_somemoreco (
id serial NOT NULL,
name varchar(255) NULL default NULL,
listorder integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_las ON phplist_listattr_somemoreco (name);
CREATE TABLE phplist_listmessage (
id serial NOT NULL,
messageid integer NOT NULL default '0',
listid integer NOT NULL default '0',
entered timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX messageid_lm ON phplist_listmessage (messageid, listid);
CREATE TABLE phplist_listrss (
listid integer NOT NULL default '0',
type varchar(255) NULL default NULL,
entered timestamp NULL default NULL,
info text
);
CREATE TABLE phplist_listuser (
userid integer NOT NULL default '0',
listid integer NOT NULL default '0',
entered timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (userid,listid)
);
CREATE TABLE phplist_message (
id serial NOT NULL,
subject varchar(255) NOT NULL default '',
fromfield varchar(255) NOT NULL default '',
tofield varchar(255) NOT NULL default '',
replyto varchar(255) NOT NULL default '',
message text,
footer text,
entered timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
status varchar(255) NULL default NULL,
processed integer default '0',
userselection text,
sent timestamp NULL default NULL,
htmlformatted integer default '0',
sendformat varchar(20) NULL default NULL,
template integer NULL default NULL,
astext integer default '0',
ashtml integer default '0',
astextandhtml integer default '0',
viewed integer default '0',
bouncecount integer default '0',
sendstart timestamp NULL default NULL,
aspdf integer default '0',
astextandpdf integer default '0',
rsstemplate varchar(100) NULL default NULL,
owner integer NULL default NULL,
embargo timestamp NULL default NULL,
repeatinterval integer default '0',
repeatuntil timestamp NULL default NULL,
textmessage text,
PRIMARY KEY (id)
);
CREATE TABLE phplist_message_attachment (
id serial NOT NULL,
messageid integer NOT NULL default '0',
attachmentid integer NOT NULL default '0',
PRIMARY KEY (id)
);
CREATE TABLE phplist_messagedata (
name varchar(100) NOT NULL default '',
id integer NOT NULL default '0',
data text,
PRIMARY KEY (name,id)
);
CREATE TABLE phplist_rssitem (
id serial NOT NULL,
title varchar(100) NOT NULL default '',
link varchar(100) NOT NULL default '',
source varchar(255) NULL default NULL,
list integer NULL default NULL,
added timestamp NULL default NULL,
processed integer default '0',
astext integer default '0',
ashtml integer default '0',
PRIMARY KEY (id)
);
CREATE INDEX title_rss ON phplist_rssitem (title, link);
CREATE TABLE phplist_rssitem_data (
itemid integer NOT NULL default '0',
tag varchar(100) NOT NULL default '',
data text,
PRIMARY KEY (itemid,tag)
);
CREATE TABLE phplist_rssitem_user (
itemid integer NOT NULL default '0',
userid integer NOT NULL default '0',
entered timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (itemid,userid)
);
CREATE TABLE phplist_sendprocess (
id serial NOT NULL,
started timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
alive integer default '1',
ipaddress varchar(50) NULL default NULL,
page varchar(100) NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_subscribepage (
id serial NOT NULL,
title varchar(255) NOT NULL default '',
active integer default '0',
owner integer NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_subscribepage_data (
id integer NOT NULL default '0',
name varchar(100) NOT NULL default '',
data text,
PRIMARY KEY (id,name)
);
CREATE TABLE phplist_task (
id serial NOT NULL,
page varchar(25) NULL default NULL,
type varchar(25) NULL default NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX page ON phplist_task (page);
CREATE TABLE phplist_template (
id serial NOT NULL,
title varchar(255) NOT NULL default '',
template text,
listorder integer NULL default NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX title_template ON phplist_template (title);
CREATE TABLE phplist_templateimage (
id serial NOT NULL,
template integer NULL default NULL,
mimetype varchar(100) NULL default NULL,
filename varchar(100) NULL default NULL,
data bytea,
width integer NULL default NULL,
height integer NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_urlcache (
id serial NOT NULL,
url varchar(255) NOT NULL default '',
lastmodified integer NULL default NULL,
added timestamp NULL default NULL,
content text,
PRIMARY KEY (id)
);
CREATE INDEX urlindex_urlcache ON phplist_urlcache (url);
CREATE TABLE phplist_user_attribute (
id serial NOT NULL,
name varchar(255) NOT NULL default '',
type varchar(30) NULL default NULL,
listorder integer NULL default NULL,
default_value varchar(255) NULL default NULL,
required integer NULL default NULL,
tablename varchar(255) NULL default NULL,
PRIMARY KEY (id)
);
CREATE TABLE phplist_user_blacklist (
email varchar(255) NOT NULL default '',
added timestamp NULL default NULL
);
CREATE UNIQUE INDEX email_bl ON phplist_user_blacklist (email);
CREATE TABLE phplist_user_blacklist_data (
email varchar(255) NOT NULL default '',
name varchar(100) NULL default NULL,
data text
);
CREATE UNIQUE INDEX email_bld ON phplist_user_blacklist_data (email);
CREATE TABLE phplist_user_message_bounce (
id serial NOT NULL,
"user" integer NOT NULL default '0',
message integer NOT NULL default '0',
bounce integer NOT NULL default '0',
time timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE INDEX user_b ON phplist_user_message_bounce ("user", message, bounce);
CREATE TABLE phplist_user_message_forward (
id serial NOT NULL,
"user" integer NOT NULL default '0',
message integer NOT NULL default '0',
forward varchar(255) NULL default NULL,
status varchar(255) NULL default NULL,
time timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE INDEX user_mf ON phplist_user_message_forward ("user", message);
CREATE TABLE phplist_user_rss (
userid integer NOT NULL default '0',
last timestamp NULL default NULL,
PRIMARY KEY (userid)
);
CREATE TABLE phplist_user_user (
id serial NOT NULL,
email varchar(255) NOT NULL default '',
confirmed integer default '0',
optedin integer default '0',
entered timestamp NULL default NULL,
modified timestamp NOT NULL default CURRENT_TIMESTAMP,
uniqid varchar(255) NULL default NULL,
htmlemail integer default '0',
bouncecount integer default '0',
subscribepage integer default '0',
rssfrequency varchar(100) NULL default NULL,
password varchar(255) NULL default NULL,
passwordchanged timestamp NULL default NULL,
disabled integer default '0',
extradata text,
foreignkey varchar(100) NULL default NULL,
blacklisted integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX email_u ON phplist_user_user (email);
CREATE INDEX fkey ON phplist_user_user (foreignkey);
CREATE INDEX index_uniqid ON phplist_user_user (uniqid);
CREATE TABLE phplist_user_user_attribute (
attributeid integer NOT NULL default '0',
userid integer NOT NULL default '0',
value text,
PRIMARY KEY (attributeid,userid)
);
CREATE INDEX userindex_ua ON phplist_user_user_attribute (userid);
CREATE INDEX attindex ON phplist_user_user_attribute (attributeid);
CREATE INDEX userattid ON phplist_user_user_attribute (attributeid, userid);
CREATE INDEX attuserid ON phplist_user_user_attribute (userid, attributeid);
CREATE TABLE phplist_user_user_history (
id serial NOT NULL,
userid integer NOT NULL default '0',
ip varchar(255) NULL default NULL,
date timestamp NULL default NULL,
summary varchar(255) NULL default NULL,
detail text,
systeminfo text,
PRIMARY KEY (id)
);
CREATE TABLE phplist_usermessage (
messageid integer NOT NULL default '0',
userid integer NOT NULL default '0',
entered timestamp NULL default NULL,
viewed timestamp NULL default NULL,
status varchar(255) NULL default NULL,
PRIMARY KEY (userid,messageid)
);
CREATE INDEX userindex_um ON phplist_usermessage (userid);
CREATE INDEX messageindex ON phplist_usermessage (messageid);
CREATE INDEX enteredindex ON phplist_usermessage (entered);
CREATE TABLE phplist_userstats (
id serial NOT NULL,
unixdate integer NULL default NULL,
item varchar(255) NULL default NULL,
listid integer default '0',
value integer default '0',
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX entry ON phplist_userstats (unixdate, item, listid);
CREATE INDEX listdateindex ON phplist_userstats (listid, unixdate);
commit;