aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/schemas/oracle_schema.sql
blob: 9660dbf3862e5dee71b2896f4b77cce4ba7db32a (plain)
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
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
/*

 $Id$

*/

/*
  This first section is optional, however its probably the best method
  of running phpBB on Oracle. If you already have a tablespace and user created
  for phpBB you can leave this section commented out!

  The first set of statements create a phpBB tablespace and a phpBB user,
  make sure you change the password of the phpBB user before you run this script!!
*/

/*
CREATE TABLESPACE "PHPBB"
	LOGGING 
	DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' 
	SIZE 10M
	AUTOEXTEND ON NEXT 10M
	MAXSIZE 100M;

CREATE USER "PHPBB" 
	PROFILE "DEFAULT" 
	IDENTIFIED BY "phpbb_password" 
	DEFAULT TABLESPACE "PHPBB" 
	QUOTA UNLIMITED ON "PHPBB" 
	ACCOUNT UNLOCK;

GRANT ANALYZE ANY TO "PHPBB";
GRANT CREATE SEQUENCE TO "PHPBB";
GRANT CREATE SESSION TO "PHPBB";
GRANT CREATE TABLE TO "PHPBB";
GRANT CREATE TRIGGER TO "PHPBB";
GRANT CREATE VIEW TO "PHPBB";
GRANT "CONNECT" TO "PHPBB";

COMMIT;
DISCONNECT;

CONNECT phpbb/phpbb_password;
*/
/*
	Table: 'phpbb_attachments'
*/
CREATE TABLE phpbb_attachments (
	attach_id number(8) NOT NULL,
	post_msg_id number(8) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	in_message number(1) DEFAULT '0' NOT NULL,
	poster_id number(8) DEFAULT '0' NOT NULL,
	is_orphan number(1) DEFAULT '1' NOT NULL,
	physical_filename varchar2(255) DEFAULT '' ,
	real_filename varchar2(255) DEFAULT '' ,
	download_count number(8) DEFAULT '0' NOT NULL,
	attach_comment clob DEFAULT '' ,
	extension varchar2(100) DEFAULT '' ,
	mimetype varchar2(100) DEFAULT '' ,
	filesize number(20) DEFAULT '0' NOT NULL,
	filetime number(11) DEFAULT '0' NOT NULL,
	thumbnail number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_attachments PRIMARY KEY (attach_id)
)
/

CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime)
/
CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id)
/
CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id)
/
CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id)
/
CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan)
/

CREATE SEQUENCE phpbb_attachments_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_attachments
BEFORE INSERT ON phpbb_attachments
FOR EACH ROW WHEN (
	new.attach_id IS NULL OR new.attach_id = 0
)
BEGIN
	SELECT phpbb_attachments_seq.nextval
	INTO :new.attach_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_acl_groups'
*/
CREATE TABLE phpbb_acl_groups (
	group_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	auth_option_id number(8) DEFAULT '0' NOT NULL,
	auth_role_id number(8) DEFAULT '0' NOT NULL,
	auth_setting number(2) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id)
/
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id)
/
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id)
/

/*
	Table: 'phpbb_acl_options'
*/
CREATE TABLE phpbb_acl_options (
	auth_option_id number(8) NOT NULL,
	auth_option varchar2(50) DEFAULT '' ,
	is_global number(1) DEFAULT '0' NOT NULL,
	is_local number(1) DEFAULT '0' NOT NULL,
	founder_only number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id)
)
/

CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option)
/

CREATE SEQUENCE phpbb_acl_options_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_acl_options
BEFORE INSERT ON phpbb_acl_options
FOR EACH ROW WHEN (
	new.auth_option_id IS NULL OR new.auth_option_id = 0
)
BEGIN
	SELECT phpbb_acl_options_seq.nextval
	INTO :new.auth_option_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_acl_roles'
*/
CREATE TABLE phpbb_acl_roles (
	role_id number(8) NOT NULL,
	role_name varchar2(765) DEFAULT '' ,
	role_description clob DEFAULT '' ,
	role_type varchar2(10) DEFAULT '' ,
	role_order number(4) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_acl_roles PRIMARY KEY (role_id)
)
/

CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type)
/
CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order)
/

CREATE SEQUENCE phpbb_acl_roles_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_acl_roles
BEFORE INSERT ON phpbb_acl_roles
FOR EACH ROW WHEN (
	new.role_id IS NULL OR new.role_id = 0
)
BEGIN
	SELECT phpbb_acl_roles_seq.nextval
	INTO :new.role_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_acl_roles_data'
*/
CREATE TABLE phpbb_acl_roles_data (
	role_id number(8) DEFAULT '0' NOT NULL,
	auth_option_id number(8) DEFAULT '0' NOT NULL,
	auth_setting number(2) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_acl_roles_data PRIMARY KEY (role_id, auth_option_id)
)
/

CREATE INDEX phpbb_acl_roles_data_ath_opt_id ON phpbb_acl_roles_data (auth_option_id)
/

/*
	Table: 'phpbb_acl_users'
*/
CREATE TABLE phpbb_acl_users (
	user_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	auth_option_id number(8) DEFAULT '0' NOT NULL,
	auth_role_id number(8) DEFAULT '0' NOT NULL,
	auth_setting number(2) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id)
/
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id)
/
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id)
/

/*
	Table: 'phpbb_banlist'
*/
CREATE TABLE phpbb_banlist (
	ban_id number(8) NOT NULL,
	ban_userid number(8) DEFAULT '0' NOT NULL,
	ban_ip varchar2(40) DEFAULT '' ,
	ban_email varchar2(300) DEFAULT '' ,
	ban_start number(11) DEFAULT '0' NOT NULL,
	ban_end number(11) DEFAULT '0' NOT NULL,
	ban_exclude number(1) DEFAULT '0' NOT NULL,
	ban_reason varchar2(3000) DEFAULT '' ,
	ban_give_reason varchar2(3000) DEFAULT '' ,
	CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id)
)
/

CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end)
/
CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude)
/
CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude)
/
CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude)
/

CREATE SEQUENCE phpbb_banlist_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_banlist
BEFORE INSERT ON phpbb_banlist
FOR EACH ROW WHEN (
	new.ban_id IS NULL OR new.ban_id = 0
)
BEGIN
	SELECT phpbb_banlist_seq.nextval
	INTO :new.ban_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_bbcodes'
*/
CREATE TABLE phpbb_bbcodes (
	bbcode_id number(3) DEFAULT '0' NOT NULL,
	bbcode_tag varchar2(16) DEFAULT '' ,
	bbcode_helpline varchar2(765) DEFAULT '' ,
	display_on_posting number(1) DEFAULT '0' NOT NULL,
	bbcode_match clob DEFAULT '' ,
	bbcode_tpl clob DEFAULT '' ,
	first_pass_match clob DEFAULT '' ,
	first_pass_replace clob DEFAULT '' ,
	second_pass_match clob DEFAULT '' ,
	second_pass_replace clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id)
)
/

CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting)
/

/*
	Table: 'phpbb_bookmarks'
*/
CREATE TABLE phpbb_bookmarks (
	topic_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_bookmarks PRIMARY KEY (topic_id, user_id)
)
/


/*
	Table: 'phpbb_bots'
*/
CREATE TABLE phpbb_bots (
	bot_id number(8) NOT NULL,
	bot_active number(1) DEFAULT '1' NOT NULL,
	bot_name varchar2(765) DEFAULT '' ,
	user_id number(8) DEFAULT '0' NOT NULL,
	bot_agent varchar2(255) DEFAULT '' ,
	bot_ip varchar2(255) DEFAULT '' ,
	CONSTRAINT pk_phpbb_bots PRIMARY KEY (bot_id)
)
/

CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active)
/

CREATE SEQUENCE phpbb_bots_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_bots
BEFORE INSERT ON phpbb_bots
FOR EACH ROW WHEN (
	new.bot_id IS NULL OR new.bot_id = 0
)
BEGIN
	SELECT phpbb_bots_seq.nextval
	INTO :new.bot_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_config'
*/
CREATE TABLE phpbb_config (
	config_name varchar2(255) DEFAULT '' ,
	config_value varchar2(765) DEFAULT '' ,
	is_dynamic number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name)
)
/

CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic)
/

/*
	Table: 'phpbb_confirm'
*/
CREATE TABLE phpbb_confirm (
	confirm_id char(32) DEFAULT '' ,
	session_id char(32) DEFAULT '' ,
	confirm_type number(3) DEFAULT '0' NOT NULL,
	code varchar2(8) DEFAULT '' ,
	seed number(10) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id)
)
/

CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type)
/

/*
	Table: 'phpbb_disallow'
*/
CREATE TABLE phpbb_disallow (
	disallow_id number(8) NOT NULL,
	disallow_username varchar2(765) DEFAULT '' ,
	CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id)
)
/


CREATE SEQUENCE phpbb_disallow_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_disallow
BEFORE INSERT ON phpbb_disallow
FOR EACH ROW WHEN (
	new.disallow_id IS NULL OR new.disallow_id = 0
)
BEGIN
	SELECT phpbb_disallow_seq.nextval
	INTO :new.disallow_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_drafts'
*/
CREATE TABLE phpbb_drafts (
	draft_id number(8) NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	save_time number(11) DEFAULT '0' NOT NULL,
	draft_subject varchar2(300) DEFAULT '' ,
	draft_message clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id)
)
/

CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time)
/

CREATE SEQUENCE phpbb_drafts_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_drafts
BEFORE INSERT ON phpbb_drafts
FOR EACH ROW WHEN (
	new.draft_id IS NULL OR new.draft_id = 0
)
BEGIN
	SELECT phpbb_drafts_seq.nextval
	INTO :new.draft_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_extensions'
*/
CREATE TABLE phpbb_extensions (
	extension_id number(8) NOT NULL,
	group_id number(8) DEFAULT '0' NOT NULL,
	extension varchar2(100) DEFAULT '' ,
	CONSTRAINT pk_phpbb_extensions PRIMARY KEY (extension_id)
)
/


CREATE SEQUENCE phpbb_extensions_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_extensions
BEFORE INSERT ON phpbb_extensions
FOR EACH ROW WHEN (
	new.extension_id IS NULL OR new.extension_id = 0
)
BEGIN
	SELECT phpbb_extensions_seq.nextval
	INTO :new.extension_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_extension_groups'
*/
CREATE TABLE phpbb_extension_groups (
	group_id number(8) NOT NULL,
	group_name varchar2(765) DEFAULT '' ,
	cat_id number(2) DEFAULT '0' NOT NULL,
	allow_group number(1) DEFAULT '0' NOT NULL,
	download_mode number(1) DEFAULT '1' NOT NULL,
	upload_icon varchar2(255) DEFAULT '' ,
	max_filesize number(20) DEFAULT '0' NOT NULL,
	allowed_forums clob DEFAULT '' ,
	allow_in_pm number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id)
)
/


CREATE SEQUENCE phpbb_extension_groups_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_extension_groups
BEFORE INSERT ON phpbb_extension_groups
FOR EACH ROW WHEN (
	new.group_id IS NULL OR new.group_id = 0
)
BEGIN
	SELECT phpbb_extension_groups_seq.nextval
	INTO :new.group_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_forums'
*/
CREATE TABLE phpbb_forums (
	forum_id number(8) NOT NULL,
	parent_id number(8) DEFAULT '0' NOT NULL,
	left_id number(8) DEFAULT '0' NOT NULL,
	right_id number(8) DEFAULT '0' NOT NULL,
	forum_parents clob DEFAULT '' ,
	forum_name varchar2(765) DEFAULT '' ,
	forum_desc clob DEFAULT '' ,
	forum_desc_bitfield varchar2(255) DEFAULT '' ,
	forum_desc_options number(11) DEFAULT '7' NOT NULL,
	forum_desc_uid varchar2(5) DEFAULT '' ,
	forum_link varchar2(765) DEFAULT '' ,
	forum_password varchar2(120) DEFAULT '' ,
	forum_style number(4) DEFAULT '0' NOT NULL,
	forum_image varchar2(255) DEFAULT '' ,
	forum_rules clob DEFAULT '' ,
	forum_rules_link varchar2(765) DEFAULT '' ,
	forum_rules_bitfield varchar2(255) DEFAULT '' ,
	forum_rules_options number(11) DEFAULT '7' NOT NULL,
	forum_rules_uid varchar2(5) DEFAULT '' ,
	forum_topics_per_page number(4) DEFAULT '0' NOT NULL,
	forum_type number(4) DEFAULT '0' NOT NULL,
	forum_status number(4) DEFAULT '0' NOT NULL,
	forum_posts number(8) DEFAULT '0' NOT NULL,
	forum_topics number(8) DEFAULT '0' NOT NULL,
	forum_topics_real number(8) DEFAULT '0' NOT NULL,
	forum_last_post_id number(8) DEFAULT '0' NOT NULL,
	forum_last_poster_id number(8) DEFAULT '0' NOT NULL,
	forum_last_post_subject varchar2(300) DEFAULT '' ,
	forum_last_post_time number(11) DEFAULT '0' NOT NULL,
	forum_last_poster_name varchar2(765) DEFAULT '' ,
	forum_last_poster_colour varchar2(6) DEFAULT '' ,
	forum_flags number(4) DEFAULT '32' NOT NULL,
	display_on_index number(1) DEFAULT '1' NOT NULL,
	enable_indexing number(1) DEFAULT '1' NOT NULL,
	enable_icons number(1) DEFAULT '1' NOT NULL,
	enable_prune number(1) DEFAULT '0' NOT NULL,
	prune_next number(11) DEFAULT '0' NOT NULL,
	prune_days number(8) DEFAULT '0' NOT NULL,
	prune_viewed number(8) DEFAULT '0' NOT NULL,
	prune_freq number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id)
)
/

CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id)
/
CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id)
/

CREATE SEQUENCE phpbb_forums_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_forums
BEFORE INSERT ON phpbb_forums
FOR EACH ROW WHEN (
	new.forum_id IS NULL OR new.forum_id = 0
)
BEGIN
	SELECT phpbb_forums_seq.nextval
	INTO :new.forum_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_forums_access'
*/
CREATE TABLE phpbb_forums_access (
	forum_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	session_id char(32) DEFAULT '' ,
	CONSTRAINT pk_phpbb_forums_access PRIMARY KEY (forum_id, user_id, session_id)
)
/


/*
	Table: 'phpbb_forums_track'
*/
CREATE TABLE phpbb_forums_track (
	user_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	mark_time number(11) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_forums_track PRIMARY KEY (user_id, forum_id)
)
/


/*
	Table: 'phpbb_forums_watch'
*/
CREATE TABLE phpbb_forums_watch (
	forum_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	notify_status number(1) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id)
/
CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id)
/
CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status)
/

/*
	Table: 'phpbb_groups'
*/
CREATE TABLE phpbb_groups (
	group_id number(8) NOT NULL,
	group_type number(4) DEFAULT '1' NOT NULL,
	group_founder_manage number(1) DEFAULT '0' NOT NULL,
	group_name varchar2(255) DEFAULT '' ,
	group_desc clob DEFAULT '' ,
	group_desc_bitfield varchar2(255) DEFAULT '' ,
	group_desc_options number(11) DEFAULT '7' NOT NULL,
	group_desc_uid varchar2(5) DEFAULT '' ,
	group_display number(1) DEFAULT '0' NOT NULL,
	group_avatar varchar2(255) DEFAULT '' ,
	group_avatar_type number(4) DEFAULT '0' NOT NULL,
	group_avatar_width number(4) DEFAULT '0' NOT NULL,
	group_avatar_height number(4) DEFAULT '0' NOT NULL,
	group_rank number(8) DEFAULT '0' NOT NULL,
	group_colour varchar2(6) DEFAULT '' ,
	group_sig_chars number(8) DEFAULT '0' NOT NULL,
	group_receive_pm number(1) DEFAULT '0' NOT NULL,
	group_message_limit number(8) DEFAULT '0' NOT NULL,
	group_legend number(1) DEFAULT '1' NOT NULL,
	CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id)
)
/

CREATE INDEX phpbb_groups_group_legend ON phpbb_groups (group_legend)
/

CREATE SEQUENCE phpbb_groups_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_groups
BEFORE INSERT ON phpbb_groups
FOR EACH ROW WHEN (
	new.group_id IS NULL OR new.group_id = 0
)
BEGIN
	SELECT phpbb_groups_seq.nextval
	INTO :new.group_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_icons'
*/
CREATE TABLE phpbb_icons (
	icons_id number(8) NOT NULL,
	icons_url varchar2(255) DEFAULT '' ,
	icons_width number(4) DEFAULT '0' NOT NULL,
	icons_height number(4) DEFAULT '0' NOT NULL,
	icons_order number(8) DEFAULT '0' NOT NULL,
	display_on_posting number(1) DEFAULT '1' NOT NULL,
	CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id)
)
/

CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting)
/

CREATE SEQUENCE phpbb_icons_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_icons
BEFORE INSERT ON phpbb_icons
FOR EACH ROW WHEN (
	new.icons_id IS NULL OR new.icons_id = 0
)
BEGIN
	SELECT phpbb_icons_seq.nextval
	INTO :new.icons_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_lang'
*/
CREATE TABLE phpbb_lang (
	lang_id number(4) NOT NULL,
	lang_iso varchar2(30) DEFAULT '' ,
	lang_dir varchar2(30) DEFAULT '' ,
	lang_english_name varchar2(300) DEFAULT '' ,
	lang_local_name varchar2(765) DEFAULT '' ,
	lang_author varchar2(765) DEFAULT '' ,
	CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id)
)
/

CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso)
/

CREATE SEQUENCE phpbb_lang_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_lang
BEFORE INSERT ON phpbb_lang
FOR EACH ROW WHEN (
	new.lang_id IS NULL OR new.lang_id = 0
)
BEGIN
	SELECT phpbb_lang_seq.nextval
	INTO :new.lang_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_log'
*/
CREATE TABLE phpbb_log (
	log_id number(8) NOT NULL,
	log_type number(4) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	reportee_id number(8) DEFAULT '0' NOT NULL,
	log_ip varchar2(40) DEFAULT '' ,
	log_time number(11) DEFAULT '0' NOT NULL,
	log_operation clob DEFAULT '' ,
	log_data clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id)
)
/

CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type)
/
CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id)
/
CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id)
/
CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id)
/
CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id)
/

CREATE SEQUENCE phpbb_log_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_log
BEFORE INSERT ON phpbb_log
FOR EACH ROW WHEN (
	new.log_id IS NULL OR new.log_id = 0
)
BEGIN
	SELECT phpbb_log_seq.nextval
	INTO :new.log_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_moderator_cache'
*/
CREATE TABLE phpbb_moderator_cache (
	forum_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	username varchar2(765) DEFAULT '' ,
	group_id number(8) DEFAULT '0' NOT NULL,
	group_name varchar2(765) DEFAULT '' ,
	display_on_index number(1) DEFAULT '1' NOT NULL
)
/

CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index)
/
CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id)
/

/*
	Table: 'phpbb_modules'
*/
CREATE TABLE phpbb_modules (
	module_id number(8) NOT NULL,
	module_enabled number(1) DEFAULT '1' NOT NULL,
	module_display number(1) DEFAULT '1' NOT NULL,
	module_basename varchar2(255) DEFAULT '' ,
	module_class varchar2(10) DEFAULT '' ,
	parent_id number(8) DEFAULT '0' NOT NULL,
	left_id number(8) DEFAULT '0' NOT NULL,
	right_id number(8) DEFAULT '0' NOT NULL,
	module_langname varchar2(255) DEFAULT '' ,
	module_mode varchar2(255) DEFAULT '' ,
	module_auth varchar2(255) DEFAULT '' ,
	CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id)
)
/

CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id)
/
CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled)
/
CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id)
/

CREATE SEQUENCE phpbb_modules_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_modules
BEFORE INSERT ON phpbb_modules
FOR EACH ROW WHEN (
	new.module_id IS NULL OR new.module_id = 0
)
BEGIN
	SELECT phpbb_modules_seq.nextval
	INTO :new.module_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_poll_options'
*/
CREATE TABLE phpbb_poll_options (
	poll_option_id number(4) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	poll_option_text clob DEFAULT '' ,
	poll_option_total number(8) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id)
/
CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id)
/

/*
	Table: 'phpbb_poll_votes'
*/
CREATE TABLE phpbb_poll_votes (
	topic_id number(8) DEFAULT '0' NOT NULL,
	poll_option_id number(4) DEFAULT '0' NOT NULL,
	vote_user_id number(8) DEFAULT '0' NOT NULL,
	vote_user_ip varchar2(40) DEFAULT '' 
)
/

CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id)
/
CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id)
/
CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip)
/

/*
	Table: 'phpbb_posts'
*/
CREATE TABLE phpbb_posts (
	post_id number(8) NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	poster_id number(8) DEFAULT '0' NOT NULL,
	icon_id number(8) DEFAULT '0' NOT NULL,
	poster_ip varchar2(40) DEFAULT '' ,
	post_time number(11) DEFAULT '0' NOT NULL,
	post_approved number(1) DEFAULT '1' NOT NULL,
	post_reported number(1) DEFAULT '0' NOT NULL,
	enable_bbcode number(1) DEFAULT '1' NOT NULL,
	enable_smilies number(1) DEFAULT '1' NOT NULL,
	enable_magic_url number(1) DEFAULT '1' NOT NULL,
	enable_sig number(1) DEFAULT '1' NOT NULL,
	post_username varchar2(765) DEFAULT '' ,
	post_subject varchar2(300) DEFAULT '' ,
	post_text clob DEFAULT '' ,
	post_checksum varchar2(32) DEFAULT '' ,
	post_attachment number(1) DEFAULT '0' NOT NULL,
	bbcode_bitfield varchar2(255) DEFAULT '' ,
	bbcode_uid varchar2(5) DEFAULT '' ,
	post_postcount number(1) DEFAULT '1' NOT NULL,
	post_edit_time number(11) DEFAULT '0' NOT NULL,
	post_edit_reason varchar2(765) DEFAULT '' ,
	post_edit_user number(8) DEFAULT '0' NOT NULL,
	post_edit_count number(4) DEFAULT '0' NOT NULL,
	post_edit_locked number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id)
)
/

CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id)
/
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id)
/
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip)
/
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id)
/
CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved)
/
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time)
/

CREATE SEQUENCE phpbb_posts_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_posts
BEFORE INSERT ON phpbb_posts
FOR EACH ROW WHEN (
	new.post_id IS NULL OR new.post_id = 0
)
BEGIN
	SELECT phpbb_posts_seq.nextval
	INTO :new.post_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_privmsgs'
*/
CREATE TABLE phpbb_privmsgs (
	msg_id number(8) NOT NULL,
	root_level number(8) DEFAULT '0' NOT NULL,
	author_id number(8) DEFAULT '0' NOT NULL,
	icon_id number(8) DEFAULT '0' NOT NULL,
	author_ip varchar2(40) DEFAULT '' ,
	message_time number(11) DEFAULT '0' NOT NULL,
	enable_bbcode number(1) DEFAULT '1' NOT NULL,
	enable_smilies number(1) DEFAULT '1' NOT NULL,
	enable_magic_url number(1) DEFAULT '1' NOT NULL,
	enable_sig number(1) DEFAULT '1' NOT NULL,
	message_subject varchar2(300) DEFAULT '' ,
	message_text clob DEFAULT '' ,
	message_edit_reason varchar2(765) DEFAULT '' ,
	message_edit_user number(8) DEFAULT '0' NOT NULL,
	message_attachment number(1) DEFAULT '0' NOT NULL,
	bbcode_bitfield varchar2(255) DEFAULT '' ,
	bbcode_uid varchar2(5) DEFAULT '' ,
	message_edit_time number(11) DEFAULT '0' NOT NULL,
	message_edit_count number(4) DEFAULT '0' NOT NULL,
	to_address clob DEFAULT '' ,
	bcc_address clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id)
)
/

CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip)
/
CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time)
/
CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id)
/
CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level)
/

CREATE SEQUENCE phpbb_privmsgs_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_privmsgs
BEFORE INSERT ON phpbb_privmsgs
FOR EACH ROW WHEN (
	new.msg_id IS NULL OR new.msg_id = 0
)
BEGIN
	SELECT phpbb_privmsgs_seq.nextval
	INTO :new.msg_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_privmsgs_folder'
*/
CREATE TABLE phpbb_privmsgs_folder (
	folder_id number(8) NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	folder_name varchar2(765) DEFAULT '' ,
	pm_count number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id)
)
/

CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id)
/

CREATE SEQUENCE phpbb_privmsgs_folder_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_folder
BEFORE INSERT ON phpbb_privmsgs_folder
FOR EACH ROW WHEN (
	new.folder_id IS NULL OR new.folder_id = 0
)
BEGIN
	SELECT phpbb_privmsgs_folder_seq.nextval
	INTO :new.folder_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_privmsgs_rules'
*/
CREATE TABLE phpbb_privmsgs_rules (
	rule_id number(8) NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	rule_check number(8) DEFAULT '0' NOT NULL,
	rule_connection number(8) DEFAULT '0' NOT NULL,
	rule_string varchar2(765) DEFAULT '' ,
	rule_user_id number(8) DEFAULT '0' NOT NULL,
	rule_group_id number(8) DEFAULT '0' NOT NULL,
	rule_action number(8) DEFAULT '0' NOT NULL,
	rule_folder_id number(11) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id)
)
/

CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id)
/

CREATE SEQUENCE phpbb_privmsgs_rules_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_rules
BEFORE INSERT ON phpbb_privmsgs_rules
FOR EACH ROW WHEN (
	new.rule_id IS NULL OR new.rule_id = 0
)
BEGIN
	SELECT phpbb_privmsgs_rules_seq.nextval
	INTO :new.rule_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_privmsgs_to'
*/
CREATE TABLE phpbb_privmsgs_to (
	msg_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	author_id number(8) DEFAULT '0' NOT NULL,
	pm_deleted number(1) DEFAULT '0' NOT NULL,
	pm_new number(1) DEFAULT '1' NOT NULL,
	pm_unread number(1) DEFAULT '1' NOT NULL,
	pm_replied number(1) DEFAULT '0' NOT NULL,
	pm_marked number(1) DEFAULT '0' NOT NULL,
	pm_forwarded number(1) DEFAULT '0' NOT NULL,
	folder_id number(11) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id)
/
CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id)
/
CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id)
/

/*
	Table: 'phpbb_profile_fields'
*/
CREATE TABLE phpbb_profile_fields (
	field_id number(8) NOT NULL,
	field_name varchar2(765) DEFAULT '' ,
	field_type number(4) DEFAULT '0' NOT NULL,
	field_ident varchar2(20) DEFAULT '' ,
	field_length varchar2(20) DEFAULT '' ,
	field_minlen varchar2(255) DEFAULT '' ,
	field_maxlen varchar2(255) DEFAULT '' ,
	field_novalue varchar2(765) DEFAULT '' ,
	field_default_value varchar2(765) DEFAULT '' ,
	field_validation varchar2(60) DEFAULT '' ,
	field_required number(1) DEFAULT '0' NOT NULL,
	field_show_on_reg number(1) DEFAULT '0' NOT NULL,
	field_hide number(1) DEFAULT '0' NOT NULL,
	field_no_view number(1) DEFAULT '0' NOT NULL,
	field_active number(1) DEFAULT '0' NOT NULL,
	field_order number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id)
)
/

CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type)
/
CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order)
/

CREATE SEQUENCE phpbb_profile_fields_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_profile_fields
BEFORE INSERT ON phpbb_profile_fields
FOR EACH ROW WHEN (
	new.field_id IS NULL OR new.field_id = 0
)
BEGIN
	SELECT phpbb_profile_fields_seq.nextval
	INTO :new.field_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_profile_fields_data'
*/
CREATE TABLE phpbb_profile_fields_data (
	user_id number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id)
)
/


/*
	Table: 'phpbb_profile_fields_lang'
*/
CREATE TABLE phpbb_profile_fields_lang (
	field_id number(8) DEFAULT '0' NOT NULL,
	lang_id number(8) DEFAULT '0' NOT NULL,
	option_id number(8) DEFAULT '0' NOT NULL,
	field_type number(4) DEFAULT '0' NOT NULL,
	lang_value varchar2(765) DEFAULT '' ,
	CONSTRAINT pk_phpbb_profile_fields_lang PRIMARY KEY (field_id, lang_id, option_id)
)
/


/*
	Table: 'phpbb_profile_lang'
*/
CREATE TABLE phpbb_profile_lang (
	field_id number(8) DEFAULT '0' NOT NULL,
	lang_id number(8) DEFAULT '0' NOT NULL,
	lang_name varchar2(765) DEFAULT '' ,
	lang_explain clob DEFAULT '' ,
	lang_default_value varchar2(765) DEFAULT '' ,
	CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id)
)
/


/*
	Table: 'phpbb_ranks'
*/
CREATE TABLE phpbb_ranks (
	rank_id number(8) NOT NULL,
	rank_title varchar2(765) DEFAULT '' ,
	rank_min number(8) DEFAULT '0' NOT NULL,
	rank_special number(1) DEFAULT '0' NOT NULL,
	rank_image varchar2(255) DEFAULT '' ,
	CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id)
)
/


CREATE SEQUENCE phpbb_ranks_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_ranks
BEFORE INSERT ON phpbb_ranks
FOR EACH ROW WHEN (
	new.rank_id IS NULL OR new.rank_id = 0
)
BEGIN
	SELECT phpbb_ranks_seq.nextval
	INTO :new.rank_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_reports'
*/
CREATE TABLE phpbb_reports (
	report_id number(8) NOT NULL,
	reason_id number(4) DEFAULT '0' NOT NULL,
	post_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	user_notify number(1) DEFAULT '0' NOT NULL,
	report_closed number(1) DEFAULT '0' NOT NULL,
	report_time number(11) DEFAULT '0' NOT NULL,
	report_text clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id)
)
/


CREATE SEQUENCE phpbb_reports_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_reports
BEFORE INSERT ON phpbb_reports
FOR EACH ROW WHEN (
	new.report_id IS NULL OR new.report_id = 0
)
BEGIN
	SELECT phpbb_reports_seq.nextval
	INTO :new.report_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_reports_reasons'
*/
CREATE TABLE phpbb_reports_reasons (
	reason_id number(4) NOT NULL,
	reason_title varchar2(765) DEFAULT '' ,
	reason_description clob DEFAULT '' ,
	reason_order number(4) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id)
)
/


CREATE SEQUENCE phpbb_reports_reasons_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_reports_reasons
BEFORE INSERT ON phpbb_reports_reasons
FOR EACH ROW WHEN (
	new.reason_id IS NULL OR new.reason_id = 0
)
BEGIN
	SELECT phpbb_reports_reasons_seq.nextval
	INTO :new.reason_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_search_results'
*/
CREATE TABLE phpbb_search_results (
	search_key varchar2(32) DEFAULT '' ,
	search_time number(11) DEFAULT '0' NOT NULL,
	search_keywords clob DEFAULT '' ,
	search_authors clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_key)
)
/


/*
	Table: 'phpbb_search_wordlist'
*/
CREATE TABLE phpbb_search_wordlist (
	word_id number(8) NOT NULL,
	word_text varchar2(765) DEFAULT '' ,
	word_common number(1) DEFAULT '0' NOT NULL,
	word_count number(8) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id),
	CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text)
)
/

CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count)
/

CREATE SEQUENCE phpbb_search_wordlist_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_search_wordlist
BEFORE INSERT ON phpbb_search_wordlist
FOR EACH ROW WHEN (
	new.word_id IS NULL OR new.word_id = 0
)
BEGIN
	SELECT phpbb_search_wordlist_seq.nextval
	INTO :new.word_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_search_wordmatch'
*/
CREATE TABLE phpbb_search_wordmatch (
	post_id number(8) DEFAULT '0' NOT NULL,
	word_id number(8) DEFAULT '0' NOT NULL,
	title_match number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT u_phpbb_unq_mtch UNIQUE (word_id, post_id, title_match)
)
/

CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id)
/
CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id)
/

/*
	Table: 'phpbb_sessions'
*/
CREATE TABLE phpbb_sessions (
	session_id char(32) DEFAULT '' ,
	session_user_id number(8) DEFAULT '0' NOT NULL,
	session_last_visit number(11) DEFAULT '0' NOT NULL,
	session_start number(11) DEFAULT '0' NOT NULL,
	session_time number(11) DEFAULT '0' NOT NULL,
	session_ip varchar2(40) DEFAULT '' ,
	session_browser varchar2(150) DEFAULT '' ,
	session_forwarded_for varchar2(255) DEFAULT '' ,
	session_page varchar2(765) DEFAULT '' ,
	session_viewonline number(1) DEFAULT '1' NOT NULL,
	session_autologin number(1) DEFAULT '0' NOT NULL,
	session_admin number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id)
)
/

CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time)
/
CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id)
/

/*
	Table: 'phpbb_sessions_keys'
*/
CREATE TABLE phpbb_sessions_keys (
	key_id char(32) DEFAULT '' ,
	user_id number(8) DEFAULT '0' NOT NULL,
	last_ip varchar2(40) DEFAULT '' ,
	last_login number(11) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_sessions_keys PRIMARY KEY (key_id, user_id)
)
/

CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login)
/

/*
	Table: 'phpbb_sitelist'
*/
CREATE TABLE phpbb_sitelist (
	site_id number(8) NOT NULL,
	site_ip varchar2(40) DEFAULT '' ,
	site_hostname varchar2(255) DEFAULT '' ,
	ip_exclude number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_sitelist PRIMARY KEY (site_id)
)
/


CREATE SEQUENCE phpbb_sitelist_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_sitelist
BEFORE INSERT ON phpbb_sitelist
FOR EACH ROW WHEN (
	new.site_id IS NULL OR new.site_id = 0
)
BEGIN
	SELECT phpbb_sitelist_seq.nextval
	INTO :new.site_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_smilies'
*/
CREATE TABLE phpbb_smilies (
	smiley_id number(8) NOT NULL,
	code varchar2(150) DEFAULT '' ,
	emotion varchar2(150) DEFAULT '' ,
	smiley_url varchar2(50) DEFAULT '' ,
	smiley_width number(4) DEFAULT '0' NOT NULL,
	smiley_height number(4) DEFAULT '0' NOT NULL,
	smiley_order number(8) DEFAULT '0' NOT NULL,
	display_on_posting number(1) DEFAULT '1' NOT NULL,
	CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id)
)
/

CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting)
/

CREATE SEQUENCE phpbb_smilies_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_smilies
BEFORE INSERT ON phpbb_smilies
FOR EACH ROW WHEN (
	new.smiley_id IS NULL OR new.smiley_id = 0
)
BEGIN
	SELECT phpbb_smilies_seq.nextval
	INTO :new.smiley_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles'
*/
CREATE TABLE phpbb_styles (
	style_id number(4) NOT NULL,
	style_name varchar2(765) DEFAULT '' ,
	style_copyright varchar2(765) DEFAULT '' ,
	style_active number(1) DEFAULT '1' NOT NULL,
	template_id number(4) DEFAULT '0' NOT NULL,
	theme_id number(4) DEFAULT '0' NOT NULL,
	imageset_id number(4) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id),
	CONSTRAINT u_phpbb_style_name UNIQUE (style_name)
)
/

CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id)
/
CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id)
/
CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id)
/

CREATE SEQUENCE phpbb_styles_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles
BEFORE INSERT ON phpbb_styles
FOR EACH ROW WHEN (
	new.style_id IS NULL OR new.style_id = 0
)
BEGIN
	SELECT phpbb_styles_seq.nextval
	INTO :new.style_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles_template'
*/
CREATE TABLE phpbb_styles_template (
	template_id number(4) NOT NULL,
	template_name varchar2(765) DEFAULT '' ,
	template_copyright varchar2(765) DEFAULT '' ,
	template_path varchar2(100) DEFAULT '' ,
	bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL,
	template_storedb number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_styles_template PRIMARY KEY (template_id),
	CONSTRAINT u_phpbb_tmplte_nm UNIQUE (template_name)
)
/


CREATE SEQUENCE phpbb_styles_template_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles_template
BEFORE INSERT ON phpbb_styles_template
FOR EACH ROW WHEN (
	new.template_id IS NULL OR new.template_id = 0
)
BEGIN
	SELECT phpbb_styles_template_seq.nextval
	INTO :new.template_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles_template_data'
*/
CREATE TABLE phpbb_styles_template_data (
	template_id number(4) NOT NULL,
	template_filename varchar2(100) DEFAULT '' ,
	template_included clob DEFAULT '' ,
	template_mtime number(11) DEFAULT '0' NOT NULL,
	template_data clob DEFAULT '' 
)
/

CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id)
/
CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename)
/

CREATE SEQUENCE phpbb_styles_template_data_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles_template_data
BEFORE INSERT ON phpbb_styles_template_data
FOR EACH ROW WHEN (
	new.template_id IS NULL OR new.template_id = 0
)
BEGIN
	SELECT phpbb_styles_template_data_seq.nextval
	INTO :new.template_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles_theme'
*/
CREATE TABLE phpbb_styles_theme (
	theme_id number(4) NOT NULL,
	theme_name varchar2(765) DEFAULT '' ,
	theme_copyright varchar2(765) DEFAULT '' ,
	theme_path varchar2(100) DEFAULT '' ,
	theme_storedb number(1) DEFAULT '0' NOT NULL,
	theme_mtime number(11) DEFAULT '0' NOT NULL,
	theme_data clob DEFAULT '' ,
	CONSTRAINT pk_phpbb_styles_theme PRIMARY KEY (theme_id),
	CONSTRAINT u_phpbb_theme_name UNIQUE (theme_name)
)
/


CREATE SEQUENCE phpbb_styles_theme_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles_theme
BEFORE INSERT ON phpbb_styles_theme
FOR EACH ROW WHEN (
	new.theme_id IS NULL OR new.theme_id = 0
)
BEGIN
	SELECT phpbb_styles_theme_seq.nextval
	INTO :new.theme_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles_imageset'
*/
CREATE TABLE phpbb_styles_imageset (
	imageset_id number(4) NOT NULL,
	imageset_name varchar2(765) DEFAULT '' ,
	imageset_copyright varchar2(765) DEFAULT '' ,
	imageset_path varchar2(100) DEFAULT '' ,
	CONSTRAINT pk_phpbb_styles_imageset PRIMARY KEY (imageset_id),
	CONSTRAINT u_phpbb_imgset_nm UNIQUE (imageset_name)
)
/


CREATE SEQUENCE phpbb_styles_imageset_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles_imageset
BEFORE INSERT ON phpbb_styles_imageset
FOR EACH ROW WHEN (
	new.imageset_id IS NULL OR new.imageset_id = 0
)
BEGIN
	SELECT phpbb_styles_imageset_seq.nextval
	INTO :new.imageset_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_styles_imageset_data'
*/
CREATE TABLE phpbb_styles_imageset_data (
	image_id number(4) NOT NULL,
	image_name varchar2(200) DEFAULT '' ,
	image_filename varchar2(200) DEFAULT '' ,
	image_lang varchar2(30) DEFAULT '' ,
	image_height number(4) DEFAULT '0' NOT NULL,
	image_width number(4) DEFAULT '0' NOT NULL,
	imageset_id number(4) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_styles_imageset_data PRIMARY KEY (image_id)
)
/

CREATE INDEX phpbb_styles_imageset_data_i_id ON phpbb_styles_imageset_data (imageset_id)
/

CREATE SEQUENCE phpbb_styles_imageset_data_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_styles_imageset_data
BEFORE INSERT ON phpbb_styles_imageset_data
FOR EACH ROW WHEN (
	new.image_id IS NULL OR new.image_id = 0
)
BEGIN
	SELECT phpbb_styles_imageset_data_seq.nextval
	INTO :new.image_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_topics'
*/
CREATE TABLE phpbb_topics (
	topic_id number(8) NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	icon_id number(8) DEFAULT '0' NOT NULL,
	topic_attachment number(1) DEFAULT '0' NOT NULL,
	topic_approved number(1) DEFAULT '1' NOT NULL,
	topic_reported number(1) DEFAULT '0' NOT NULL,
	topic_title varchar2(300) DEFAULT '' ,
	topic_poster number(8) DEFAULT '0' NOT NULL,
	topic_time number(11) DEFAULT '0' NOT NULL,
	topic_time_limit number(11) DEFAULT '0' NOT NULL,
	topic_views number(8) DEFAULT '0' NOT NULL,
	topic_replies number(8) DEFAULT '0' NOT NULL,
	topic_replies_real number(8) DEFAULT '0' NOT NULL,
	topic_status number(3) DEFAULT '0' NOT NULL,
	topic_type number(3) DEFAULT '0' NOT NULL,
	topic_first_post_id number(8) DEFAULT '0' NOT NULL,
	topic_first_poster_name varchar2(765) DEFAULT '' ,
	topic_first_poster_colour varchar2(6) DEFAULT '' ,
	topic_last_post_id number(8) DEFAULT '0' NOT NULL,
	topic_last_poster_id number(8) DEFAULT '0' NOT NULL,
	topic_last_poster_name varchar2(765) DEFAULT '' ,
	topic_last_poster_colour varchar2(6) DEFAULT '' ,
	topic_last_post_subject varchar2(300) DEFAULT '' ,
	topic_last_post_time number(11) DEFAULT '0' NOT NULL,
	topic_last_view_time number(11) DEFAULT '0' NOT NULL,
	topic_moved_id number(8) DEFAULT '0' NOT NULL,
	topic_bumped number(1) DEFAULT '0' NOT NULL,
	topic_bumper number(8) DEFAULT '0' NOT NULL,
	poll_title varchar2(765) DEFAULT '' ,
	poll_start number(11) DEFAULT '0' NOT NULL,
	poll_length number(11) DEFAULT '0' NOT NULL,
	poll_max_options number(4) DEFAULT '1' NOT NULL,
	poll_last_vote number(11) DEFAULT '0' NOT NULL,
	poll_vote_change number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id)
)
/

CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id)
/
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type)
/
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time)
/
CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved)
/
CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id)
/
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id)
/

CREATE SEQUENCE phpbb_topics_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_topics
BEFORE INSERT ON phpbb_topics
FOR EACH ROW WHEN (
	new.topic_id IS NULL OR new.topic_id = 0
)
BEGIN
	SELECT phpbb_topics_seq.nextval
	INTO :new.topic_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_topics_track'
*/
CREATE TABLE phpbb_topics_track (
	user_id number(8) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	forum_id number(8) DEFAULT '0' NOT NULL,
	mark_time number(11) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_topics_track PRIMARY KEY (user_id, topic_id)
)
/

CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id)
/

/*
	Table: 'phpbb_topics_posted'
*/
CREATE TABLE phpbb_topics_posted (
	user_id number(8) DEFAULT '0' NOT NULL,
	topic_id number(8) DEFAULT '0' NOT NULL,
	topic_posted number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_topics_posted PRIMARY KEY (user_id, topic_id)
)
/


/*
	Table: 'phpbb_topics_watch'
*/
CREATE TABLE phpbb_topics_watch (
	topic_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	notify_status number(1) DEFAULT '0' NOT NULL
)
/

CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id)
/
CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id)
/
CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status)
/

/*
	Table: 'phpbb_user_group'
*/
CREATE TABLE phpbb_user_group (
	group_id number(8) DEFAULT '0' NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	group_leader number(1) DEFAULT '0' NOT NULL,
	user_pending number(1) DEFAULT '1' NOT NULL
)
/

CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id)
/
CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id)
/
CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader)
/

/*
	Table: 'phpbb_users'
*/
CREATE TABLE phpbb_users (
	user_id number(8) NOT NULL,
	user_type number(2) DEFAULT '0' NOT NULL,
	group_id number(8) DEFAULT '3' NOT NULL,
	user_permissions clob DEFAULT '' ,
	user_perm_from number(8) DEFAULT '0' NOT NULL,
	user_ip varchar2(40) DEFAULT '' ,
	user_regdate number(11) DEFAULT '0' NOT NULL,
	username varchar2(255) DEFAULT '' ,
	username_clean varchar2(255) DEFAULT '' ,
	user_password varchar2(120) DEFAULT '' ,
	user_passchg number(11) DEFAULT '0' NOT NULL,
	user_pass_convert number(1) DEFAULT '0' NOT NULL,
	user_email varchar2(300) DEFAULT '' ,
	user_email_hash number(20) DEFAULT '0' NOT NULL,
	user_birthday varchar2(10) DEFAULT '' ,
	user_lastvisit number(11) DEFAULT '0' NOT NULL,
	user_lastmark number(11) DEFAULT '0' NOT NULL,
	user_lastpost_time number(11) DEFAULT '0' NOT NULL,
	user_lastpage varchar2(600) DEFAULT '' ,
	user_last_confirm_key varchar2(10) DEFAULT '' ,
	user_last_search number(11) DEFAULT '0' NOT NULL,
	user_warnings number(4) DEFAULT '0' NOT NULL,
	user_last_warning number(11) DEFAULT '0' NOT NULL,
	user_login_attempts number(4) DEFAULT '0' NOT NULL,
	user_inactive_reason number(2) DEFAULT '0' NOT NULL,
	user_inactive_time number(11) DEFAULT '0' NOT NULL,
	user_posts number(8) DEFAULT '0' NOT NULL,
	user_lang varchar2(30) DEFAULT '' ,
	user_timezone number(5, 2) DEFAULT '0' NOT NULL,
	user_dst number(1) DEFAULT '0' NOT NULL,
	user_dateformat varchar2(90) DEFAULT 'd M Y H:i' NOT NULL,
	user_style number(4) DEFAULT '0' NOT NULL,
	user_rank number(8) DEFAULT '0' NOT NULL,
	user_colour varchar2(6) DEFAULT '' ,
	user_new_privmsg number(4) DEFAULT '0' NOT NULL,
	user_unread_privmsg number(4) DEFAULT '0' NOT NULL,
	user_last_privmsg number(11) DEFAULT '0' NOT NULL,
	user_message_rules number(1) DEFAULT '0' NOT NULL,
	user_full_folder number(11) DEFAULT '-3' NOT NULL,
	user_emailtime number(11) DEFAULT '0' NOT NULL,
	user_topic_show_days number(4) DEFAULT '0' NOT NULL,
	user_topic_sortby_type varchar2(1) DEFAULT 't' NOT NULL,
	user_topic_sortby_dir varchar2(1) DEFAULT 'd' NOT NULL,
	user_post_show_days number(4) DEFAULT '0' NOT NULL,
	user_post_sortby_type varchar2(1) DEFAULT 't' NOT NULL,
	user_post_sortby_dir varchar2(1) DEFAULT 'a' NOT NULL,
	user_notify number(1) DEFAULT '0' NOT NULL,
	user_notify_pm number(1) DEFAULT '1' NOT NULL,
	user_notify_type number(4) DEFAULT '0' NOT NULL,
	user_allow_pm number(1) DEFAULT '1' NOT NULL,
	user_allow_viewonline number(1) DEFAULT '1' NOT NULL,
	user_allow_viewemail number(1) DEFAULT '1' NOT NULL,
	user_allow_massemail number(1) DEFAULT '1' NOT NULL,
	user_options number(11) DEFAULT '895' NOT NULL,
	user_avatar varchar2(255) DEFAULT '' ,
	user_avatar_type number(2) DEFAULT '0' NOT NULL,
	user_avatar_width number(4) DEFAULT '0' NOT NULL,
	user_avatar_height number(4) DEFAULT '0' NOT NULL,
	user_sig clob DEFAULT '' ,
	user_sig_bbcode_uid varchar2(5) DEFAULT '' ,
	user_sig_bbcode_bitfield varchar2(255) DEFAULT '' ,
	user_from varchar2(300) DEFAULT '' ,
	user_icq varchar2(15) DEFAULT '' ,
	user_aim varchar2(765) DEFAULT '' ,
	user_yim varchar2(765) DEFAULT '' ,
	user_msnm varchar2(765) DEFAULT '' ,
	user_jabber varchar2(765) DEFAULT '' ,
	user_website varchar2(600) DEFAULT '' ,
	user_occ clob DEFAULT '' ,
	user_interests clob DEFAULT '' ,
	user_actkey varchar2(32) DEFAULT '' ,
	user_newpasswd varchar2(96) DEFAULT '' ,
	CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id),
	CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean)
)
/

CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday)
/
CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash)
/
CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type)
/

CREATE SEQUENCE phpbb_users_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_users
BEFORE INSERT ON phpbb_users
FOR EACH ROW WHEN (
	new.user_id IS NULL OR new.user_id = 0
)
BEGIN
	SELECT phpbb_users_seq.nextval
	INTO :new.user_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_warnings'
*/
CREATE TABLE phpbb_warnings (
	warning_id number(8) NOT NULL,
	user_id number(8) DEFAULT '0' NOT NULL,
	post_id number(8) DEFAULT '0' NOT NULL,
	log_id number(8) DEFAULT '0' NOT NULL,
	warning_time number(11) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id)
)
/


CREATE SEQUENCE phpbb_warnings_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_warnings
BEFORE INSERT ON phpbb_warnings
FOR EACH ROW WHEN (
	new.warning_id IS NULL OR new.warning_id = 0
)
BEGIN
	SELECT phpbb_warnings_seq.nextval
	INTO :new.warning_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_words'
*/
CREATE TABLE phpbb_words (
	word_id number(8) NOT NULL,
	word varchar2(765) DEFAULT '' ,
	replacement varchar2(765) DEFAULT '' ,
	CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id)
)
/


CREATE SEQUENCE phpbb_words_seq
/

CREATE OR REPLACE TRIGGER t_phpbb_words
BEFORE INSERT ON phpbb_words
FOR EACH ROW WHEN (
	new.word_id IS NULL OR new.word_id = 0
)
BEGIN
	SELECT phpbb_words_seq.nextval
	INTO :new.word_id
	FROM dual;
END;
/


/*
	Table: 'phpbb_zebra'
*/
CREATE TABLE phpbb_zebra (
	user_id number(8) DEFAULT '0' NOT NULL,
	zebra_id number(8) DEFAULT '0' NOT NULL,
	friend number(1) DEFAULT '0' NOT NULL,
	foe number(1) DEFAULT '0' NOT NULL,
	CONSTRAINT pk_phpbb_zebra PRIMARY KEY (user_id, zebra_id)
)
/