-
Notifications
You must be signed in to change notification settings - Fork 8
/
slashschema_create.sql
999 lines (890 loc) · 25.9 KB
/
slashschema_create.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
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
# MySQL dump 8.10
#
# Host: localhost Database: dump
#--------------------------------------------------------
# Server version 3.23.26-beta
#
# $Id$
#
#
# Table structure for table 'abusers'
#
DROP TABLE IF EXISTS abusers;
CREATE TABLE abusers (
abuser_id mediumint UNSIGNED NOT NULL auto_increment,
uid mediumint UNSIGNED NOT NULL,
ipid char(32) DEFAULT '' NOT NULL,
subnetid char(32) DEFAULT '' NOT NULL,
pagename varchar(20) DEFAULT '' NOT NULL,
ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
reason varchar(120) DEFAULT '' NOT NULL,
querystring varchar(200) DEFAULT '' NOT NULL,
PRIMARY KEY (abuser_id),
KEY uid (uid),
KEY ipid (ipid),
KEY subnetid (subnetid),
KEY reason (reason),
KEY ts (ts)
) TYPE = myisam;
DROP TABLE IF EXISTS accesslist;
CREATE TABLE accesslist (
id mediumint NOT NULL auto_increment,
uid mediumint UNSIGNED NOT NULL,
ipid char(32),
subnetid char(32),
formname varchar(20) DEFAULT '' NOT NULL,
readonly tinyint UNSIGNED DEFAULT 0 NOT NULL,
isbanned tinyint UNSIGNED DEFAULT 0 NOT NULL,
ts datetime default '0000-00-00 00:00:00' NOT NULL,
reason varchar(120),
PRIMARY KEY id (id),
key uid (uid),
key ipid (ipid),
key subnetid (subnetid),
key formname (formname),
key ts (ts)
) TYPE = myisam;
DROP TABLE IF EXISTS accesslog;
CREATE TABLE accesslog (
id int UNSIGNED NOT NULL auto_increment,
host_addr char(32) DEFAULT '' NOT NULL,
subnetid char(32) DEFAULT '' NOT NULL,
op varchar(254),
dat varchar(254),
uid mediumint UNSIGNED NOT NULL,
ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
query_string varchar(50),
user_agent varchar(50),
section varchar(30) DEFAULT 'index' NOT NULL,
bytes mediumint UNSIGNED DEFAULT 0 NOT NULL,
INDEX host_addr_part (host_addr(16)),
INDEX op_part (op(12), section),
INDEX ts (ts),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'authors_cache'
#
DROP TABLE IF EXISTS authors_cache;
CREATE TABLE authors_cache (
uid mediumint UNSIGNED NOT NULL auto_increment,
nickname varchar(20) NOT NULL,
fakeemail varchar(75) NOT NULL,
homepage varchar(100) NOT NULL,
storycount mediumint NOT NULL,
bio text NOT NULL,
author tinyint DEFAULT 0 NOT NULL,
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'backup_blocks'
#
DROP TABLE IF EXISTS backup_blocks;
CREATE TABLE backup_blocks (
bid varchar(30) DEFAULT '' NOT NULL,
block text,
FOREIGN KEY (bid) REFERENCES blocks(bid),
PRIMARY KEY (bid)
) TYPE = myisam;
#
# Table structure for table 'blocks'
#
DROP TABLE IF EXISTS blocks;
CREATE TABLE blocks (
bid varchar(30) DEFAULT '' NOT NULL,
block text,
seclev mediumint UNSIGNED NOT NULL DEFAULT '0',
type ENUM("static","color","portald") DEFAULT 'static' NOT NULL,
description text,
section varchar(30) NOT NULL,
ordernum tinyint DEFAULT '0',
title varchar(128) NOT NULL,
portal tinyint NOT NULL DEFAULT '0',
url varchar(128),
rdf varchar(255),
retrieve tinyint NOT NULL DEFAULT '0',
last_update timestamp,
rss_template varchar(30),
items smallint NOT NULL DEFAULT '0',
autosubmit enum("no","yes") DEFAULT 'no' NOT NULL,
rss_cookie varchar(255),
all_sections tinyint NOT NULL DEFAULT '0',
FOREIGN KEY (rss_template) REFERENCES templates(name),
PRIMARY KEY (bid),
KEY type (type),
KEY section (section)
) TYPE = myisam;
#
# Table structure for table 'code_param'
#
DROP TABLE IF EXISTS code_param;
CREATE TABLE code_param (
param_id smallint UNSIGNED NOT NULL auto_increment,
type varchar(16) NOT NULL,
code tinyint DEFAULT '0' NOT NULL,
name varchar(32) NOT NULL,
UNIQUE code_key (type,code),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'commentmodes'
#
DROP TABLE IF EXISTS commentmodes;
CREATE TABLE commentmodes (
mode varchar(16) DEFAULT '' NOT NULL,
name varchar(32),
description varchar(64),
PRIMARY KEY (mode)
) TYPE = myisam;
#
# Table structure for table 'comments'
#
DROP TABLE IF EXISTS comments;
CREATE TABLE comments (
sid mediumint UNSIGNED NOT NULL,
cid mediumint UNSIGNED NOT NULL auto_increment,
pid mediumint UNSIGNED DEFAULT '0' NOT NULL,
date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
ipid char(32) DEFAULT '' NOT NULL,
subnetid char(32) DEFAULT '' NOT NULL,
subject varchar(50) NOT NULL,
uid mediumint UNSIGNED NOT NULL,
points tinyint DEFAULT '0' NOT NULL,
lastmod mediumint UNSIGNED DEFAULT '0' NOT NULL,
reason tinyint UNSIGNED DEFAULT '0' NOT NULL,
signature char(32) DEFAULT '' NOT NULL,
PRIMARY KEY (cid),
KEY display (sid,points,uid),
KEY byname (uid,points),
KEY ipid (ipid),
KEY subnetid (subnetid),
KEY theusual (sid,uid,points,cid),
KEY countreplies (pid,sid)
) TYPE = myisam;
#
# Table structure for table 'comment_text'
#
DROP TABLE IF EXISTS comment_text;
CREATE TABLE comment_text (
cid mediumint UNSIGNED NOT NULL,
comment text NOT NULL,
FOREIGN KEY (cid) REFERENCES comments(cid),
PRIMARY KEY (cid)
) TYPE = myisam;
#
# Table structure for table 'content_filters'
#
DROP TABLE IF EXISTS content_filters;
CREATE TABLE content_filters (
filter_id tinyint UNSIGNED NOT NULL auto_increment,
form varchar(20) DEFAULT '' NOT NULL,
regex varchar(100) DEFAULT '' NOT NULL,
modifier varchar(5) DEFAULT '' NOT NULL,
field varchar(20) DEFAULT '' NOT NULL,
ratio float(6,4) DEFAULT '0.0000' NOT NULL,
minimum_match mediumint(6) DEFAULT '0' NOT NULL,
minimum_length mediumint DEFAULT '0' NOT NULL,
err_message varchar(150) DEFAULT '',
PRIMARY KEY (filter_id),
KEY form (form),
KEY regex (regex),
KEY field_key (field)
) TYPE = myisam;
#
# Table structure for table 'dateformats'
#
DROP TABLE IF EXISTS dateformats;
CREATE TABLE dateformats (
id tinyint UNSIGNED DEFAULT '0' NOT NULL,
format varchar(32),
description varchar(64),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'discussions'
#
DROP TABLE IF EXISTS discussions;
CREATE TABLE discussions (
id mediumint UNSIGNED NOT NULL auto_increment,
sid char(16) DEFAULT '' NOT NULL,
title varchar(128) NOT NULL,
url varchar(255) NOT NULL,
topic smallint UNSIGNED NOT NULL,
ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
type enum("open","recycle","archived") DEFAULT 'open' NOT NULL,
uid mediumint UNSIGNED NOT NULL,
commentcount smallint UNSIGNED DEFAULT '0' NOT NULL,
flags enum("ok","delete","dirty") DEFAULT 'ok' NOT NULL,
section varchar(30) NOT NULL,
last_update timestamp,
approved tinyint UNSIGNED DEFAULT 0 NOT NULL,
KEY (sid),
FOREIGN KEY (sid) REFERENCES stories(sid),
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (topic) REFERENCES topics(tid),
INDEX (type,uid,ts),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'formkeys'
#
DROP TABLE IF EXISTS formkeys;
CREATE TABLE formkeys (
formkey varchar(20) DEFAULT '' NOT NULL,
formname varchar(32) DEFAULT '' NOT NULL,
id varchar(30) DEFAULT '' NOT NULL,
idcount mediumint UNSIGNED DEFAULT 0 NOT NULL,
uid mediumint UNSIGNED NOT NULL,
ipid char(32) DEFAULT '' NOT NULL,
subnetid char(32) DEFAULT '' NOT NULL,
value tinyint DEFAULT '0' NOT NULL,
last_ts int UNSIGNED DEFAULT '0' NOT NULL,
ts int UNSIGNED DEFAULT '0' NOT NULL,
submit_ts int UNSIGNED DEFAULT '0' NOT NULL,
content_length smallint UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (formkey),
FOREIGN KEY (uid) REFERENCES users(uid),
KEY formname (formname),
KEY uid (uid),
KEY ipid (ipid),
KEY subnetid (subnetid),
KEY idcount (idcount),
KEY ts (ts),
KEY last_ts (ts),
KEY submit_ts (submit_ts)
) TYPE = myisam;
#
# Table structure for table 'hooks'
#
DROP TABLE IF EXISTS hooks;
CREATE TABLE hooks (
id mediumint(5) UNSIGNED NOT NULL auto_increment,
param varchar(50) DEFAULT '' NOT NULL,
class varchar(100) DEFAULT '' NOT NULL,
subroutine varchar(100) DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE hook_param (param,class,subroutine)
) TYPE = myisam;
#
# Table structure for table 'menus'
#
DROP TABLE IF EXISTS menus;
CREATE TABLE menus (
id mediumint(5) UNSIGNED NOT NULL auto_increment,
menu varchar(20) DEFAULT '' NOT NULL,
label varchar(255) DEFAULT '' NOT NULL,
value text,
seclev mediumint UNSIGNED NOT NULL,
menuorder mediumint(5),
PRIMARY KEY (id),
KEY page_labels (menu,label),
UNIQUE page_labels_un (menu,label)
) TYPE = myisam;
#
# Table structure for table 'metamodlog'
#
DROP TABLE IF EXISTS metamodlog;
CREATE TABLE metamodlog (
id mediumint UNSIGNED NOT NULL AUTO_INCREMENT,
mmid mediumint DEFAULT '0' NOT NULL,
uid mediumint UNSIGNED DEFAULT '0' NOT NULL,
val tinyint DEFAULT '0' NOT NULL,
ts datetime,
active tinyint DEFAULT '1' NOT NULL,
INDEX byuser (uid),
INDEX mmid (mmid),
PRIMARY KEY (id),
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (mmid) REFERENCES moderatorlog(id)
) TYPE = myisam;
#
# Table structure for table 'misc_user_opts'
#
DROP TABLE IF EXISTS misc_user_opts;
CREATE TABLE misc_user_opts (
name varchar(32) NOT NULL,
optorder mediumint(5),
seclev mediumint UNSIGNED NOT NULL,
default_val text DEFAULT '' NOT NULL,
vals_regex text DEFAULT '',
short_desc text DEFAULT '',
long_desc text DEFAULT '',
opts_html text DEFAULT '',
PRIMARY KEY (name)
) TYPE = myisam;
#
# Table structure for table 'moderatorlog'
#
DROP TABLE IF EXISTS moderatorlog;
CREATE TABLE moderatorlog (
id int UNSIGNED NOT NULL auto_increment,
uid mediumint UNSIGNED NOT NULL,
val tinyint DEFAULT '0' NOT NULL,
sid mediumint UNSIGNED DEFAULT '' NOT NULL,
ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
cid mediumint UNSIGNED NOT NULL,
cuid mediumint UNSIGNED NOT NULL,
reason tinyint UNSIGNED DEFAULT '0',
active tinyint DEFAULT '1' NOT NULL,
m2count mediumint UNSIGNED DEFAULT '0' NOT NULL,
m2status tinyint DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY sid (sid,cid),
KEY sid_2 (sid,uid,cid),
KEY cid (cid)
) TYPE = myisam;
#
# Table structure for table 'modreasons'
#
DROP TABLE IF EXISTS modreasons;
CREATE TABLE modreasons (
id tinyint UNSIGNED NOT NULL,
name char(32) DEFAULT '' NOT NULL,
m2able tinyint DEFAULT '1' NOT NULL,
listable tinyint DEFAULT '1' NOT NULL,
val tinyint DEFAULT '0' NOT NULL,
fairfrac float DEFAULT '0.5' NOT NULL,
PRIMARY KEY (id)
) TYPE=myisam;
#
# Table structure for table 'pollanswers'
#
DROP TABLE IF EXISTS pollanswers;
CREATE TABLE pollanswers (
qid mediumint UNSIGNED NOT NULL,
aid mediumint NOT NULL,
answer char(255),
votes mediumint,
FOREIGN KEY (qid) REFERENCES pollquestions(qid),
PRIMARY KEY (qid,aid)
) TYPE = myisam;
#
# Table structure for table 'pollquestions'
#
DROP TABLE IF EXISTS pollquestions;
CREATE TABLE pollquestions (
qid mediumint UNSIGNED NOT NULL auto_increment,
question char(255) NOT NULL,
voters mediumint,
topic smallint UNSIGNED NOT NULL,
discussion mediumint,
date datetime,
uid mediumint UNSIGNED NOT NULL,
section varchar(30) NOT NULL,
autopoll enum("no","yes") DEFAULT 'no' NOT NULL,
flags enum("ok","delete","dirty") DEFAULT 'ok' NOT NULL,
FOREIGN KEY (section) REFERENCES sections(section),
FOREIGN KEY (discussion) REFERENCES discussions(id),
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (qid)
) TYPE = myisam;
#
# Table structure for table 'pollvoters'
#
DROP TABLE IF EXISTS pollvoters;
CREATE TABLE pollvoters (
qid mediumint NOT NULL,
id char(35) NOT NULL,
time datetime,
uid mediumint UNSIGNED NOT NULL,
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (qid) REFERENCES pollquestions(qid),
KEY qid (qid,id,uid)
) TYPE = myisam;
#
# Table structure for table 'rss_raw'
#
DROP TABLE IF EXISTS rss_raw;
CREATE TABLE rss_raw (
id mediumint UNSIGNED NOT NULL auto_increment,
link_signature char(32) DEFAULT '' NOT NULL,
title_signature char(32) DEFAULT '' NOT NULL,
description_signature char(32) DEFAULT '' NOT NULL,
link varchar(255) NOT NULL,
title varchar(255) NOT NULL,
description text,
subid mediumint UNSIGNED,
bid varchar(30),
created datetime,
processed enum("no","yes") DEFAULT 'no' NOT NULL,
UNIQUE uber_signature (link_signature, title_signature, description_signature),
FOREIGN KEY (subid) REFERENCES submissions(subid),
FOREIGN KEY (bid) REFERENCES blocks(bid),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'related_links'
#
DROP TABLE IF EXISTS related_links;
CREATE TABLE related_links (
id smallint UNSIGNED NOT NULL auto_increment,
keyword varchar(30) NOT NULL,
name varchar(30) NOT NULL,
link varchar(128) NOT NULL,
KEY (keyword),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'sections'
#
DROP TABLE IF EXISTS sections;
CREATE TABLE sections (
id smallint UNSIGNED NOT NULL auto_increment,
section varchar(30) NOT NULL,
artcount mediumint UNSIGNED DEFAULT '30' NOT NULL,
title varchar(64),
qid mediumint,
issue tinyint DEFAULT '0' NOT NULL,
extras mediumint DEFAULT '0',
url char(128) DEFAULT '' NOT NULL,
hostname char(128) DEFAULT '' NOT NULL,
cookiedomain char(128) DEFAULT '' NOT NULL,
index_handler varchar(30) DEFAULT "index.pl" NOT NULL,
writestatus ENUM("ok","dirty") DEFAULT 'ok' NOT NULL,
type ENUM("contained", "collected") DEFAULT 'contained' NOT NULL,
rewrite mediumint UNSIGNED DEFAULT '3600' NOT NULL,
last_update timestamp,
UNIQUE (section),
FOREIGN KEY (qid) REFERENCES pollquestions(qid),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'sections_contained'
#
DROP TABLE IF EXISTS sections_contained;
CREATE TABLE sections_contained (
id SMALLINT UNSIGNED NOT NULL auto_increment,
container varchar(30) NOT NULL,
section varchar(30) NOT NULL,
UNIQUE (container,section),
FOREIGN KEY (container) REFERENCES sections(section),
FOREIGN KEY (section) REFERENCES sections(section),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'section_extras'
#
DROP TABLE IF EXISTS section_extras;
CREATE TABLE section_extras (
param_id mediumint UNSIGNED NOT NULL auto_increment,
section varchar(30) NOT NULL,
name varchar(100) NOT NULL,
value varchar(100) NOT NULL,
type enum("text","list","topics") DEFAULT 'text' NOT NULL,
FOREIGN KEY (section) REFERENCES sections(section),
UNIQUE extra (section,name),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'section_topics'
#
DROP TABLE IF EXISTS section_topics;
CREATE TABLE section_topics (
section varchar(30) NOT NULL,
tid smallint UNSIGNED NOT NULL,
type varchar(16) NOT NULL DEFAULT 'topic_1',
FOREIGN KEY (section) REFERENCES sections(section),
FOREIGN KEY (tid) REFERENCES topics(tid),
PRIMARY KEY (section,type,tid)
) TYPE = myisam;
#
# Table structure for table 'subsections'
#
DROP TABLE IF EXISTS subsections;
CREATE TABLE subsections (
id smallint UNSIGNED NOT NULL auto_increment,
title varchar(30) NOT NULL,
section varchar(30) NOT NULL,
artcount mediumint DEFAULT '30' NOT NULL,
alttext varchar(40) NOT NULL,
UNIQUE code_key (title,section),
FOREIGN KEY (section) REFERENCES sections(section),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'sessions'
#
DROP TABLE IF EXISTS sessions;
CREATE TABLE sessions (
session mediumint UNSIGNED NOT NULL auto_increment,
uid mediumint UNSIGNED,
logintime datetime,
lasttime datetime,
lasttitle varchar(50),
last_subid mediumint UNSIGNED,
last_sid varchar(16),
INDEX (uid),
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (last_subid) REFERENCES submissions(subid),
PRIMARY KEY (session)
) TYPE = myisam;
DROP TABLE IF EXISTS site_info;
CREATE TABLE site_info (
param_id mediumint UNSIGNED NOT NULL auto_increment,
name varchar(50) NOT NULL,
value varchar(200) NOT NULL,
description varchar(255),
UNIQUE site_keys (name,value),
PRIMARY KEY (param_id)
) TYPE = myisam;
DROP TABLE IF EXISTS slashd_status;
CREATE TABLE slashd_status (
task VARCHAR(50) NOT NULL,
next_begin DATETIME,
in_progress TINYINT NOT NULL DEFAULT '0',
last_completed DATETIME,
summary VARCHAR(255) NOT NULL DEFAULT '',
duration float(6,2) DEFAULT '0.00' NOT NULL,
PRIMARY KEY (task)
) TYPE = myisam;
#
# Table structure for table 'spamarmors'
#
DROP TABLE IF EXISTS spamarmors;
CREATE TABLE spamarmors (
armor_id mediumint UNSIGNED NOT NULL auto_increment,
name varchar(40) default NULL,
code text,
active mediumint default '1',
PRIMARY KEY (armor_id)
) TYPE=MyISAM;
#
# Table structure for table 'stories'
#
DROP TABLE IF EXISTS stories;
CREATE TABLE stories (
sid CHAR(16) NOT NULL,
tid SMALLINT UNSIGNED NOT NULL,
uid MEDIUMINT UNSIGNED NOT NULL,
title VARCHAR(100) DEFAULT '' NOT NULL,
dept VARCHAR(100),
time DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
hits MEDIUMINT UNSIGNED DEFAULT '0' NOT NULL,
section VARCHAR(30) DEFAULT '' NOT NULL,
displaystatus TINYINT DEFAULT '0' NOT NULL,
commentstatus TINYINT,
discussion MEDIUMINT UNSIGNED,
submitter MEDIUMINT UNSIGNED NOT NULL,
commentcount SMALLINT UNSIGNED DEFAULT '0' NOT NULL,
hitparade VARCHAR(64) DEFAULT '0,0,0,0,0,0,0' NOT NULL,
writestatus ENUM("ok","delete","dirty","archived") DEFAULT 'ok' NOT NULL,
day_published DATE DEFAULT '0000-00-00' NOT NULL,
qid MEDIUMINT UNSIGNED DEFAULT NULL,
subsection SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
last_update timestamp,
PRIMARY KEY (sid),
FOREIGN KEY (uid) REFERENCES users(uid),
FOREIGN KEY (tid) REFERENCES topics(tid),
FOREIGN KEY (section) REFERENCES sections(section),
FOREIGN KEY (qid) REFERENCES pollquestions(qid),
FOREIGN KEY (subsection) REFERENCES subsections(id),
INDEX frontpage (displaystatus, writestatus,section),
INDEX time (time), /* time > now() shows that this is still valuable, even with frontpage -Brian */
INDEX submitter (submitter),
INDEX published (day_published)
) TYPE = myisam;
#
# Table structure for table 'story_text'
#
DROP TABLE IF EXISTS story_text;
CREATE TABLE story_text (
sid char(16) NOT NULL,
introtext text,
bodytext text,
relatedtext text,
FOREIGN KEY (sid) REFERENCES stories(sid),
PRIMARY KEY (sid)
) TYPE = myisam;
#
# Table structure for table 'story_param'
#
DROP TABLE IF EXISTS story_param;
CREATE TABLE story_param (
param_id mediumint UNSIGNED NOT NULL auto_increment,
sid char(16) NOT NULL,
name varchar(32) DEFAULT '' NOT NULL,
value text DEFAULT '' NOT NULL,
UNIQUE story_key (sid,name),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'story_topics'
#
DROP TABLE IF EXISTS story_topics;
CREATE TABLE story_topics (
id int(5) NOT NULL auto_increment,
sid varchar(16) NOT NULL default '',
tid smallint(5) unsigned default NULL,
FOREIGN KEY (sid) REFERENCES stories(sid),
FOREIGN KEY (tid) REFERENCES topics(tid),
PRIMARY KEY (id),
INDEX tid (tid),
INDEX sid (sid)
) TYPE = myisam;
#
# Table structure for table 'string_param'
#
DROP TABLE IF EXISTS string_param;
CREATE TABLE string_param (
param_id smallint UNSIGNED NOT NULL auto_increment,
type varchar(32) NOT NULL,
code varchar(128) NOT NULL,
name varchar(64) NOT NULL,
UNIQUE code_key (type,code),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'submissions'
#
DROP TABLE IF EXISTS submissions;
CREATE TABLE submissions (
subid mediumint UNSIGNED NOT NULL auto_increment,
email varchar(50) NOT NULL,
name varchar(50) NOT NULL,
time datetime NOT NULL,
subj varchar(50) NOT NULL,
story text NOT NULL,
tid smallint NOT NULL,
note varchar(30) DEFAULT '' NOT NULL,
section varchar(30) DEFAULT '' NOT NULL,
comment varchar(255) NOT NULL,
uid mediumint UNSIGNED NOT NULL,
ipid char(32) DEFAULT '' NOT NULL,
subnetid char(32) DEFAULT '' NOT NULL,
del tinyint DEFAULT '0' NOT NULL,
weight float DEFAULT '0' NOT NULL,
signature varchar(32) NOT NULL,
PRIMARY KEY (subid),
UNIQUE signature (signature),
FOREIGN KEY (tid) REFERENCES topics(tid),
FOREIGN KEY (uid) REFERENCES users(uid),
INDEX (del,section,note),
INDEX (uid),
KEY subid (section,subid),
KEY ipid (ipid),
KEY subnetid (subnetid)
) TYPE = myisam;
#
# Table structure for table 'submission_param'
#
DROP TABLE IF EXISTS submission_param;
CREATE TABLE submission_param (
param_id mediumint UNSIGNED NOT NULL auto_increment,
subid mediumint UNSIGNED NOT NULL,
name varchar(32) DEFAULT '' NOT NULL,
value text DEFAULT '' NOT NULL,
UNIQUE submission_key (subid,name),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'templates'
#
DROP TABLE IF EXISTS templates;
CREATE TABLE templates (
tpid mediumint UNSIGNED NOT NULL auto_increment,
name varchar(30) NOT NULL,
page varchar(20) DEFAULT 'misc' NOT NULL,
section varchar(30) DEFAULT 'default' NOT NULL,
lang char(5) DEFAULT 'en_US' NOT NULL,
template text,
seclev mediumint UNSIGNED NOT NULL,
description text,
title varchar(128),
last_update timestamp,
PRIMARY KEY (tpid),
UNIQUE true_template (name,page,section,lang)
) TYPE = myisam;
#
# Table structure for table 'topics'
#
DROP TABLE IF EXISTS topics;
CREATE TABLE topics (
tid smallint UNSIGNED NOT NULL auto_increment,
name char(20) NOT NULL,
image varchar(100),
alttext char(40),
width smallint UNSIGNED,
height smallint UNSIGNED,
PRIMARY KEY (tid)
) TYPE = myisam;
#
# Table structure for table 'tzcodes'
#
DROP TABLE IF EXISTS tzcodes;
CREATE TABLE tzcodes (
tz char(4) DEFAULT '' NOT NULL,
off_set mediumint,
description varchar(64),
PRIMARY KEY (tz)
) TYPE = myisam;
#
# Table structure for table 'users'
#
DROP TABLE IF EXISTS users;
CREATE TABLE users (
uid mediumint UNSIGNED NOT NULL auto_increment,
nickname varchar(20) DEFAULT '' NOT NULL,
realemail varchar(50) DEFAULT '' NOT NULL,
fakeemail varchar(75),
homepage varchar(100),
passwd char(32) DEFAULT '' NOT NULL,
sig varchar(160),
seclev mediumint UNSIGNED DEFAULT '0' NOT NULL, /* This is set to 0 as a safety factor */
matchname varchar(20),
newpasswd varchar(8),
journal_last_entry_date datetime,
author tinyint DEFAULT 0 NOT NULL,
PRIMARY KEY (uid),
KEY login (nickname,uid,passwd),
KEY chk4user (realemail,nickname),
KEY chk4matchname (matchname),
KEY author_lookup (author)
) TYPE = myisam;
#
# Table structure for table 'users_acl'
#
DROP TABLE IF EXISTS users_acl;
CREATE TABLE users_acl (
id mediumint UNSIGNED NOT NULL auto_increment,
uid mediumint UNSIGNED NOT NULL,
name varchar(32) NOT NULL,
value varchar(254),
UNIQUE uid_key (uid,name),
KEY uid (uid),
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (id)
) TYPE = myisam;
#
# Table structure for table 'users_comments'
#
DROP TABLE IF EXISTS users_comments;
CREATE TABLE users_comments (
uid mediumint UNSIGNED NOT NULL,
points smallint UNSIGNED DEFAULT '0' NOT NULL,
posttype mediumint DEFAULT '2' NOT NULL,
defaultpoints tinyint DEFAULT '1' NOT NULL,
highlightthresh tinyint DEFAULT '4' NOT NULL,
maxcommentsize smallint UNSIGNED DEFAULT '4096' NOT NULL,
hardthresh tinyint DEFAULT '0' NOT NULL,
clbig smallint UNSIGNED DEFAULT '0' NOT NULL,
clsmall smallint UNSIGNED DEFAULT '0' NOT NULL,
reparent tinyint DEFAULT '1' NOT NULL,
nosigs tinyint DEFAULT '0' NOT NULL,
commentlimit smallint UNSIGNED DEFAULT '100' NOT NULL,
commentspill smallint UNSIGNED DEFAULT '50' NOT NULL,
commentsort tinyint DEFAULT '0',
noscores tinyint DEFAULT '0' NOT NULL,
mode varchar(10) DEFAULT 'thread',
threshold tinyint DEFAULT '0',
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'users_count'
#
DROP TABLE IF EXISTS users_count;
CREATE TABLE users_count (
uid mediumint UNSIGNED NOT NULL,
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'users_hits'
#
DROP TABLE IF EXISTS users_hits;
CREATE TABLE users_hits (
uid mediumint UNSIGNED NOT NULL,
lastclick TIMESTAMP,
hits int DEFAULT '0' NOT NULL,
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'users_index'
#
DROP TABLE IF EXISTS users_index;
CREATE TABLE users_index (
uid mediumint UNSIGNED NOT NULL,
extid varchar(255),
exaid varchar(100),
exsect varchar(255),
exboxes varchar(255),
maxstories tinyint UNSIGNED DEFAULT '30' NOT NULL,
noboxes tinyint DEFAULT '0' NOT NULL,
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'users_info'
#
DROP TABLE IF EXISTS users_info;
CREATE TABLE users_info (
uid mediumint UNSIGNED NOT NULL,
totalmods mediumint DEFAULT '0' NOT NULL,
realname varchar(50),
bio text,
tokens mediumint DEFAULT '0' NOT NULL,
lastgranted date DEFAULT '0000-00-00' NOT NULL,
m2info varchar(64) DEFAULT '' NOT NULL,
karma mediumint DEFAULT '0' NOT NULL,
maillist tinyint DEFAULT '0' NOT NULL,
totalcomments mediumint UNSIGNED DEFAULT '0',
lastmm date DEFAULT '0000-00-00' NOT NULL,
mods_saved varchar(120) DEFAULT '' NOT NULL,
lastaccess date DEFAULT '0000-00-00' NOT NULL,
m2fair mediumint UNSIGNED DEFAULT '0' NOT NULL,
m2unfair mediumint UNSIGNED DEFAULT '0' NOT NULL,
m2fairvotes mediumint UNSIGNED DEFAULT '0' NOT NULL,
m2unfairvotes mediumint UNSIGNED DEFAULT '0' NOT NULL,
upmods mediumint UNSIGNED DEFAULT '0' NOT NULL,
downmods mediumint UNSIGNED DEFAULT '0' NOT NULL,
session_login tinyint DEFAULT '0' NOT NULL,
registered tinyint UNSIGNED DEFAULT '1' NOT NULL,
reg_id char(32) DEFAULT '' NOT NULL,
expiry_days smallint UNSIGNED DEFAULT '1' NOT NULL,
expiry_comm smallint UNSIGNED DEFAULT '1' NOT NULL,
user_expiry_days smallint UNSIGNED DEFAULT '1' NOT NULL,
user_expiry_comm smallint UNSIGNED DEFAULT '1' NOT NULL,
created_at datetime DEFAULT '0000-00-00 00:00' NOT NULL,
people blob,
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'users_param'
#
DROP TABLE IF EXISTS users_param;
CREATE TABLE users_param (
param_id mediumint UNSIGNED NOT NULL auto_increment,
uid mediumint UNSIGNED NOT NULL,
name varchar(32) DEFAULT '' NOT NULL,
value text DEFAULT '' NOT NULL,
UNIQUE uid_key (uid,name),
KEY (uid),
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (param_id)
) TYPE = myisam;
#
# Table structure for table 'users_prefs'
#
DROP TABLE IF EXISTS users_prefs;
CREATE TABLE users_prefs (
uid mediumint UNSIGNED NOT NULL,
willing tinyint DEFAULT '1' NOT NULL,
dfid tinyint UNSIGNED DEFAULT '0' NOT NULL,
tzcode char(4) DEFAULT 'EDT' NOT NULL,
noicons tinyint DEFAULT '0' NOT NULL,
light tinyint DEFAULT '0' NOT NULL,
mylinks varchar(255) DEFAULT '' NOT NULL,
lang char(5) DEFAULT 'en_US' NOT NULL,
FOREIGN KEY (uid) REFERENCES users(uid),
PRIMARY KEY (uid)
) TYPE = myisam;
#
# Table structure for table 'vars'
#
DROP TABLE IF EXISTS vars;
CREATE TABLE vars (
name varchar(48) DEFAULT '' NOT NULL,
value text,
description varchar(255),
PRIMARY KEY (name)
) TYPE = myisam;