~azzar1/unity/add-show-desktop-key

624 by dcoles
forum: Removed the subsilver2 style and phpBB installer
1
/*
2
3
 $Id: postgres_schema.sql,v 1.106 2007/12/05 15:18:21 acydburn Exp $
4
5
*/
6
7
BEGIN;
8
9
/*
10
	Domain definition
11
*/
12
CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
13
14
/*
15
	Operation Functions
16
*/
17
CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
18
CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
19
CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
20
CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
21
CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
22
CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
23
24
/*
25
	Operators
26
*/
27
CREATE OPERATOR <(
28
  PROCEDURE = _varchar_ci_less_than,
29
  LEFTARG = varchar_ci,
30
  RIGHTARG = varchar_ci,
31
  COMMUTATOR = >,
32
  NEGATOR = >=,
33
  RESTRICT = scalarltsel,
34
  JOIN = scalarltjoinsel);
35
36
CREATE OPERATOR <=(
37
  PROCEDURE = _varchar_ci_less_equal,
38
  LEFTARG = varchar_ci,
39
  RIGHTARG = varchar_ci,
40
  COMMUTATOR = >=,
41
  NEGATOR = >,
42
  RESTRICT = scalarltsel,
43
  JOIN = scalarltjoinsel);
44
45
CREATE OPERATOR >(
46
  PROCEDURE = _varchar_ci_greater_than,
47
  LEFTARG = varchar_ci,
48
  RIGHTARG = varchar_ci,
49
  COMMUTATOR = <,
50
  NEGATOR = <=,
51
  RESTRICT = scalargtsel,
52
  JOIN = scalargtjoinsel);
53
54
CREATE OPERATOR >=(
55
  PROCEDURE = _varchar_ci_greater_equals,
56
  LEFTARG = varchar_ci,
57
  RIGHTARG = varchar_ci,
58
  COMMUTATOR = <=,
59
  NEGATOR = <,
60
  RESTRICT = scalargtsel,
61
  JOIN = scalargtjoinsel);
62
63
CREATE OPERATOR <>(
64
  PROCEDURE = _varchar_ci_not_equal,
65
  LEFTARG = varchar_ci,
66
  RIGHTARG = varchar_ci,
67
  COMMUTATOR = <>,
68
  NEGATOR = =,
69
  RESTRICT = neqsel,
70
  JOIN = neqjoinsel);
71
72
CREATE OPERATOR =(
73
  PROCEDURE = _varchar_ci_equal,
74
  LEFTARG = varchar_ci,
75
  RIGHTARG = varchar_ci,
76
  COMMUTATOR = =,
77
  NEGATOR = <>,
78
  RESTRICT = eqsel,
79
  JOIN = eqjoinsel,
80
  HASHES,
81
  MERGES,
82
  SORT1= <);
83
84
/*
85
	Table: 'phpbb_attachments'
86
*/
87
CREATE SEQUENCE phpbb_attachments_seq;
88
89
CREATE TABLE phpbb_attachments (
90
	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
91
	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
92
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
93
	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
94
	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
95
	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
96
	physical_filename varchar(255) DEFAULT '' NOT NULL,
97
	real_filename varchar(255) DEFAULT '' NOT NULL,
98
	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
99
	attach_comment varchar(4000) DEFAULT '' NOT NULL,
100
	extension varchar(100) DEFAULT '' NOT NULL,
101
	mimetype varchar(100) DEFAULT '' NOT NULL,
102
	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
103
	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
104
	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
105
	PRIMARY KEY (attach_id)
106
);
107
108
CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime);
109
CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id);
110
CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id);
111
CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id);
112
CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan);
113
114
/*
115
	Table: 'phpbb_acl_groups'
116
*/
117
CREATE TABLE phpbb_acl_groups (
118
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
119
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
120
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
121
	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
122
	auth_setting INT2 DEFAULT '0' NOT NULL
123
);
124
125
CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id);
126
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id);
127
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id);
128
129
/*
130
	Table: 'phpbb_acl_options'
131
*/
132
CREATE SEQUENCE phpbb_acl_options_seq;
133
134
CREATE TABLE phpbb_acl_options (
135
	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
136
	auth_option varchar(50) DEFAULT '' NOT NULL,
137
	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
138
	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
139
	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
140
	PRIMARY KEY (auth_option_id)
141
);
142
143
CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
144
145
/*
146
	Table: 'phpbb_acl_roles'
147
*/
148
CREATE SEQUENCE phpbb_acl_roles_seq;
149
150
CREATE TABLE phpbb_acl_roles (
151
	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
152
	role_name varchar(255) DEFAULT '' NOT NULL,
153
	role_description varchar(4000) DEFAULT '' NOT NULL,
154
	role_type varchar(10) DEFAULT '' NOT NULL,
155
	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
156
	PRIMARY KEY (role_id)
157
);
158
159
CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type);
160
CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order);
161
162
/*
163
	Table: 'phpbb_acl_roles_data'
164
*/
165
CREATE TABLE phpbb_acl_roles_data (
166
	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
167
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
168
	auth_setting INT2 DEFAULT '0' NOT NULL,
169
	PRIMARY KEY (role_id, auth_option_id)
170
);
171
172
CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
173
174
/*
175
	Table: 'phpbb_acl_users'
176
*/
177
CREATE TABLE phpbb_acl_users (
178
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
179
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
180
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
181
	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
182
	auth_setting INT2 DEFAULT '0' NOT NULL
183
);
184
185
CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
186
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
187
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
188
189
/*
190
	Table: 'phpbb_banlist'
191
*/
192
CREATE SEQUENCE phpbb_banlist_seq;
193
194
CREATE TABLE phpbb_banlist (
195
	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
196
	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
197
	ban_ip varchar(40) DEFAULT '' NOT NULL,
198
	ban_email varchar(100) DEFAULT '' NOT NULL,
199
	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
200
	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
201
	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
202
	ban_reason varchar(255) DEFAULT '' NOT NULL,
203
	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
204
	PRIMARY KEY (ban_id)
205
);
206
207
CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end);
208
CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude);
209
CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude);
210
CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude);
211
212
/*
213
	Table: 'phpbb_bbcodes'
214
*/
215
CREATE TABLE phpbb_bbcodes (
216
	bbcode_id INT2 DEFAULT '0' NOT NULL,
217
	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
218
	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
219
	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
220
	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
221
	bbcode_tpl TEXT DEFAULT '' NOT NULL,
222
	first_pass_match TEXT DEFAULT '' NOT NULL,
223
	first_pass_replace TEXT DEFAULT '' NOT NULL,
224
	second_pass_match TEXT DEFAULT '' NOT NULL,
225
	second_pass_replace TEXT DEFAULT '' NOT NULL,
226
	PRIMARY KEY (bbcode_id)
227
);
228
229
CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting);
230
231
/*
232
	Table: 'phpbb_bookmarks'
233
*/
234
CREATE TABLE phpbb_bookmarks (
235
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
236
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
237
	PRIMARY KEY (topic_id, user_id)
238
);
239
240
241
/*
242
	Table: 'phpbb_bots'
243
*/
244
CREATE SEQUENCE phpbb_bots_seq;
245
246
CREATE TABLE phpbb_bots (
247
	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
248
	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
249
	bot_name varchar(255) DEFAULT '' NOT NULL,
250
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
251
	bot_agent varchar(255) DEFAULT '' NOT NULL,
252
	bot_ip varchar(255) DEFAULT '' NOT NULL,
253
	PRIMARY KEY (bot_id)
254
);
255
256
CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
257
258
/*
259
	Table: 'phpbb_config'
260
*/
261
CREATE TABLE phpbb_config (
262
	config_name varchar(255) DEFAULT '' NOT NULL,
263
	config_value varchar(255) DEFAULT '' NOT NULL,
264
	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
265
	PRIMARY KEY (config_name)
266
);
267
268
CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic);
269
270
/*
271
	Table: 'phpbb_confirm'
272
*/
273
CREATE TABLE phpbb_confirm (
274
	confirm_id char(32) DEFAULT '' NOT NULL,
275
	session_id char(32) DEFAULT '' NOT NULL,
276
	confirm_type INT2 DEFAULT '0' NOT NULL,
277
	code varchar(8) DEFAULT '' NOT NULL,
278
	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
279
	PRIMARY KEY (session_id, confirm_id)
280
);
281
282
CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
283
284
/*
285
	Table: 'phpbb_disallow'
286
*/
287
CREATE SEQUENCE phpbb_disallow_seq;
288
289
CREATE TABLE phpbb_disallow (
290
	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
291
	disallow_username varchar(255) DEFAULT '' NOT NULL,
292
	PRIMARY KEY (disallow_id)
293
);
294
295
296
/*
297
	Table: 'phpbb_drafts'
298
*/
299
CREATE SEQUENCE phpbb_drafts_seq;
300
301
CREATE TABLE phpbb_drafts (
302
	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
303
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
304
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
305
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
306
	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
307
	draft_subject varchar(100) DEFAULT '' NOT NULL,
308
	draft_message TEXT DEFAULT '' NOT NULL,
309
	PRIMARY KEY (draft_id)
310
);
311
312
CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
313
314
/*
315
	Table: 'phpbb_extensions'
316
*/
317
CREATE SEQUENCE phpbb_extensions_seq;
318
319
CREATE TABLE phpbb_extensions (
320
	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
321
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
322
	extension varchar(100) DEFAULT '' NOT NULL,
323
	PRIMARY KEY (extension_id)
324
);
325
326
327
/*
328
	Table: 'phpbb_extension_groups'
329
*/
330
CREATE SEQUENCE phpbb_extension_groups_seq;
331
332
CREATE TABLE phpbb_extension_groups (
333
	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
334
	group_name varchar(255) DEFAULT '' NOT NULL,
335
	cat_id INT2 DEFAULT '0' NOT NULL,
336
	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
337
	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
338
	upload_icon varchar(255) DEFAULT '' NOT NULL,
339
	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
340
	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
341
	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
342
	PRIMARY KEY (group_id)
343
);
344
345
346
/*
347
	Table: 'phpbb_forums'
348
*/
349
CREATE SEQUENCE phpbb_forums_seq;
350
351
CREATE TABLE phpbb_forums (
352
	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
353
	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
354
	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
355
	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
356
	forum_parents TEXT DEFAULT '' NOT NULL,
357
	forum_name varchar(255) DEFAULT '' NOT NULL,
358
	forum_desc varchar(4000) DEFAULT '' NOT NULL,
359
	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
360
	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
361
	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
362
	forum_link varchar(255) DEFAULT '' NOT NULL,
363
	forum_password varchar(40) DEFAULT '' NOT NULL,
364
	forum_style INT2 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
365
	forum_image varchar(255) DEFAULT '' NOT NULL,
366
	forum_rules varchar(4000) DEFAULT '' NOT NULL,
367
	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
368
	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
369
	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
370
	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
371
	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
372
	forum_type INT2 DEFAULT '0' NOT NULL,
373
	forum_status INT2 DEFAULT '0' NOT NULL,
374
	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
375
	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
376
	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
377
	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
378
	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
379
	forum_last_post_subject varchar(100) DEFAULT '' NOT NULL,
380
	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
381
	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
382
	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
383
	forum_flags INT2 DEFAULT '32' NOT NULL,
384
	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
385
	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
386
	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
387
	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
388
	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
389
	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
390
	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
391
	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
392
	PRIMARY KEY (forum_id)
393
);
394
395
CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id);
396
CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id);
397
398
/*
399
	Table: 'phpbb_forums_access'
400
*/
401
CREATE TABLE phpbb_forums_access (
402
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
403
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
404
	session_id char(32) DEFAULT '' NOT NULL,
405
	PRIMARY KEY (forum_id, user_id, session_id)
406
);
407
408
409
/*
410
	Table: 'phpbb_forums_track'
411
*/
412
CREATE TABLE phpbb_forums_track (
413
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
414
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
415
	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
416
	PRIMARY KEY (user_id, forum_id)
417
);
418
419
420
/*
421
	Table: 'phpbb_forums_watch'
422
*/
423
CREATE TABLE phpbb_forums_watch (
424
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
425
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
426
	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
427
);
428
429
CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id);
430
CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id);
431
CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status);
432
433
/*
434
	Table: 'phpbb_groups'
435
*/
436
CREATE SEQUENCE phpbb_groups_seq;
437
438
CREATE TABLE phpbb_groups (
439
	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
440
	group_type INT2 DEFAULT '1' NOT NULL,
441
	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
442
	group_name varchar_ci DEFAULT '' NOT NULL,
443
	group_desc varchar(4000) DEFAULT '' NOT NULL,
444
	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
445
	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
446
	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
447
	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
448
	group_avatar varchar(255) DEFAULT '' NOT NULL,
449
	group_avatar_type INT2 DEFAULT '0' NOT NULL,
450
	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
451
	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
452
	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
453
	group_colour varchar(6) DEFAULT '' NOT NULL,
454
	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
455
	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
456
	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
457
	group_legend INT2 DEFAULT '1' NOT NULL CHECK (group_legend >= 0),
458
	PRIMARY KEY (group_id)
459
);
460
461
CREATE INDEX phpbb_groups_group_legend ON phpbb_groups (group_legend);
462
463
/*
464
	Table: 'phpbb_icons'
465
*/
466
CREATE SEQUENCE phpbb_icons_seq;
467
468
CREATE TABLE phpbb_icons (
469
	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
470
	icons_url varchar(255) DEFAULT '' NOT NULL,
471
	icons_width INT2 DEFAULT '0' NOT NULL,
472
	icons_height INT2 DEFAULT '0' NOT NULL,
473
	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
474
	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
475
	PRIMARY KEY (icons_id)
476
);
477
478
CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
479
480
/*
481
	Table: 'phpbb_lang'
482
*/
483
CREATE SEQUENCE phpbb_lang_seq;
484
485
CREATE TABLE phpbb_lang (
486
	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
487
	lang_iso varchar(30) DEFAULT '' NOT NULL,
488
	lang_dir varchar(30) DEFAULT '' NOT NULL,
489
	lang_english_name varchar(100) DEFAULT '' NOT NULL,
490
	lang_local_name varchar(255) DEFAULT '' NOT NULL,
491
	lang_author varchar(255) DEFAULT '' NOT NULL,
492
	PRIMARY KEY (lang_id)
493
);
494
495
CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
496
497
/*
498
	Table: 'phpbb_log'
499
*/
500
CREATE SEQUENCE phpbb_log_seq;
501
502
CREATE TABLE phpbb_log (
503
	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
504
	log_type INT2 DEFAULT '0' NOT NULL,
505
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
506
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
507
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
508
	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
509
	log_ip varchar(40) DEFAULT '' NOT NULL,
510
	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
511
	log_operation varchar(4000) DEFAULT '' NOT NULL,
512
	log_data TEXT DEFAULT '' NOT NULL,
513
	PRIMARY KEY (log_id)
514
);
515
516
CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
517
CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id);
518
CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id);
519
CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id);
520
CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id);
521
522
/*
523
	Table: 'phpbb_moderator_cache'
524
*/
525
CREATE TABLE phpbb_moderator_cache (
526
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
527
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
528
	username varchar(255) DEFAULT '' NOT NULL,
529
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
530
	group_name varchar(255) DEFAULT '' NOT NULL,
531
	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
532
);
533
534
CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index);
535
CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id);
536
537
/*
538
	Table: 'phpbb_modules'
539
*/
540
CREATE SEQUENCE phpbb_modules_seq;
541
542
CREATE TABLE phpbb_modules (
543
	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
544
	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
545
	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
546
	module_basename varchar(255) DEFAULT '' NOT NULL,
547
	module_class varchar(10) DEFAULT '' NOT NULL,
548
	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
549
	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
550
	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
551
	module_langname varchar(255) DEFAULT '' NOT NULL,
552
	module_mode varchar(255) DEFAULT '' NOT NULL,
553
	module_auth varchar(255) DEFAULT '' NOT NULL,
554
	PRIMARY KEY (module_id)
555
);
556
557
CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id);
558
CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled);
559
CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id);
560
561
/*
562
	Table: 'phpbb_poll_options'
563
*/
564
CREATE TABLE phpbb_poll_options (
565
	poll_option_id INT2 DEFAULT '0' NOT NULL,
566
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
567
	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
568
	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
569
);
570
571
CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id);
572
CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id);
573
574
/*
575
	Table: 'phpbb_poll_votes'
576
*/
577
CREATE TABLE phpbb_poll_votes (
578
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
579
	poll_option_id INT2 DEFAULT '0' NOT NULL,
580
	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
581
	vote_user_ip varchar(40) DEFAULT '' NOT NULL
582
);
583
584
CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id);
585
CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id);
586
CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip);
587
588
/*
589
	Table: 'phpbb_posts'
590
*/
591
CREATE SEQUENCE phpbb_posts_seq;
592
593
CREATE TABLE phpbb_posts (
594
	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
595
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
596
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
597
	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
598
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
599
	poster_ip varchar(40) DEFAULT '' NOT NULL,
600
	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
601
	post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
602
	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
603
	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
604
	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
605
	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
606
	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
607
	post_username varchar(255) DEFAULT '' NOT NULL,
608
	post_subject varchar(100) DEFAULT '' NOT NULL,
609
	post_text TEXT DEFAULT '' NOT NULL,
610
	post_checksum varchar(32) DEFAULT '' NOT NULL,
611
	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
612
	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
613
	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
614
	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
615
	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
616
	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
617
	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
618
	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
619
	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
620
	PRIMARY KEY (post_id)
621
);
622
623
CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id);
624
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id);
625
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip);
626
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id);
627
CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved);
628
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
629
630
/*
631
	Table: 'phpbb_privmsgs'
632
*/
633
CREATE SEQUENCE phpbb_privmsgs_seq;
634
635
CREATE TABLE phpbb_privmsgs (
636
	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
637
	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
638
	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
639
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
640
	author_ip varchar(40) DEFAULT '' NOT NULL,
641
	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
642
	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
643
	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
644
	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
645
	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
646
	message_subject varchar(100) DEFAULT '' NOT NULL,
647
	message_text TEXT DEFAULT '' NOT NULL,
648
	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
649
	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
650
	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
651
	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
652
	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
653
	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
654
	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
655
	to_address varchar(4000) DEFAULT '' NOT NULL,
656
	bcc_address varchar(4000) DEFAULT '' NOT NULL,
657
	PRIMARY KEY (msg_id)
658
);
659
660
CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip);
661
CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time);
662
CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id);
663
CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level);
664
665
/*
666
	Table: 'phpbb_privmsgs_folder'
667
*/
668
CREATE SEQUENCE phpbb_privmsgs_folder_seq;
669
670
CREATE TABLE phpbb_privmsgs_folder (
671
	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
672
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
673
	folder_name varchar(255) DEFAULT '' NOT NULL,
674
	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
675
	PRIMARY KEY (folder_id)
676
);
677
678
CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
679
680
/*
681
	Table: 'phpbb_privmsgs_rules'
682
*/
683
CREATE SEQUENCE phpbb_privmsgs_rules_seq;
684
685
CREATE TABLE phpbb_privmsgs_rules (
686
	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
687
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
688
	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
689
	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
690
	rule_string varchar(255) DEFAULT '' NOT NULL,
691
	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
692
	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
693
	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
694
	rule_folder_id INT4 DEFAULT '0' NOT NULL,
695
	PRIMARY KEY (rule_id)
696
);
697
698
CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
699
700
/*
701
	Table: 'phpbb_privmsgs_to'
702
*/
703
CREATE TABLE phpbb_privmsgs_to (
704
	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
705
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
706
	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
707
	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
708
	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
709
	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
710
	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
711
	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
712
	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
713
	folder_id INT4 DEFAULT '0' NOT NULL
714
);
715
716
CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id);
717
CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id);
718
CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id);
719
720
/*
721
	Table: 'phpbb_profile_fields'
722
*/
723
CREATE SEQUENCE phpbb_profile_fields_seq;
724
725
CREATE TABLE phpbb_profile_fields (
726
	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
727
	field_name varchar(255) DEFAULT '' NOT NULL,
728
	field_type INT2 DEFAULT '0' NOT NULL,
729
	field_ident varchar(20) DEFAULT '' NOT NULL,
730
	field_length varchar(20) DEFAULT '' NOT NULL,
731
	field_minlen varchar(255) DEFAULT '' NOT NULL,
732
	field_maxlen varchar(255) DEFAULT '' NOT NULL,
733
	field_novalue varchar(255) DEFAULT '' NOT NULL,
734
	field_default_value varchar(255) DEFAULT '' NOT NULL,
735
	field_validation varchar(20) DEFAULT '' NOT NULL,
736
	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
737
	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
738
	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
739
	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
740
	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
741
	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
742
	PRIMARY KEY (field_id)
743
);
744
745
CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type);
746
CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order);
747
748
/*
749
	Table: 'phpbb_profile_fields_data'
750
*/
751
CREATE TABLE phpbb_profile_fields_data (
752
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
753
	PRIMARY KEY (user_id)
754
);
755
756
757
/*
758
	Table: 'phpbb_profile_fields_lang'
759
*/
760
CREATE TABLE phpbb_profile_fields_lang (
761
	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
762
	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
763
	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
764
	field_type INT2 DEFAULT '0' NOT NULL,
765
	lang_value varchar(255) DEFAULT '' NOT NULL,
766
	PRIMARY KEY (field_id, lang_id, option_id)
767
);
768
769
770
/*
771
	Table: 'phpbb_profile_lang'
772
*/
773
CREATE TABLE phpbb_profile_lang (
774
	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
775
	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
776
	lang_name varchar(255) DEFAULT '' NOT NULL,
777
	lang_explain varchar(4000) DEFAULT '' NOT NULL,
778
	lang_default_value varchar(255) DEFAULT '' NOT NULL,
779
	PRIMARY KEY (field_id, lang_id)
780
);
781
782
783
/*
784
	Table: 'phpbb_ranks'
785
*/
786
CREATE SEQUENCE phpbb_ranks_seq;
787
788
CREATE TABLE phpbb_ranks (
789
	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
790
	rank_title varchar(255) DEFAULT '' NOT NULL,
791
	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
792
	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
793
	rank_image varchar(255) DEFAULT '' NOT NULL,
794
	PRIMARY KEY (rank_id)
795
);
796
797
798
/*
799
	Table: 'phpbb_reports'
800
*/
801
CREATE SEQUENCE phpbb_reports_seq;
802
803
CREATE TABLE phpbb_reports (
804
	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
805
	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
806
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
807
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
808
	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
809
	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
810
	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
811
	report_text TEXT DEFAULT '' NOT NULL,
812
	PRIMARY KEY (report_id)
813
);
814
815
816
/*
817
	Table: 'phpbb_reports_reasons'
818
*/
819
CREATE SEQUENCE phpbb_reports_reasons_seq;
820
821
CREATE TABLE phpbb_reports_reasons (
822
	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
823
	reason_title varchar(255) DEFAULT '' NOT NULL,
824
	reason_description TEXT DEFAULT '' NOT NULL,
825
	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
826
	PRIMARY KEY (reason_id)
827
);
828
829
830
/*
831
	Table: 'phpbb_search_results'
832
*/
833
CREATE TABLE phpbb_search_results (
834
	search_key varchar(32) DEFAULT '' NOT NULL,
835
	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
836
	search_keywords TEXT DEFAULT '' NOT NULL,
837
	search_authors TEXT DEFAULT '' NOT NULL,
838
	PRIMARY KEY (search_key)
839
);
840
841
842
/*
843
	Table: 'phpbb_search_wordlist'
844
*/
845
CREATE SEQUENCE phpbb_search_wordlist_seq;
846
847
CREATE TABLE phpbb_search_wordlist (
848
	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
849
	word_text varchar(255) DEFAULT '' NOT NULL,
850
	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
851
	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
852
	PRIMARY KEY (word_id)
853
);
854
855
CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
856
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
857
858
/*
859
	Table: 'phpbb_search_wordmatch'
860
*/
861
CREATE TABLE phpbb_search_wordmatch (
862
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
863
	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
864
	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
865
);
866
867
CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match);
868
CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id);
869
CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id);
870
871
/*
872
	Table: 'phpbb_sessions'
873
*/
874
CREATE TABLE phpbb_sessions (
875
	session_id char(32) DEFAULT '' NOT NULL,
876
	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
877
	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
878
	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
879
	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
880
	session_ip varchar(40) DEFAULT '' NOT NULL,
881
	session_browser varchar(150) DEFAULT '' NOT NULL,
882
	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
883
	session_page varchar(255) DEFAULT '' NOT NULL,
884
	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
885
	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
886
	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
887
	PRIMARY KEY (session_id)
888
);
889
890
CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time);
891
CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id);
892
893
/*
894
	Table: 'phpbb_sessions_keys'
895
*/
896
CREATE TABLE phpbb_sessions_keys (
897
	key_id char(32) DEFAULT '' NOT NULL,
898
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
899
	last_ip varchar(40) DEFAULT '' NOT NULL,
900
	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
901
	PRIMARY KEY (key_id, user_id)
902
);
903
904
CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
905
906
/*
907
	Table: 'phpbb_sitelist'
908
*/
909
CREATE SEQUENCE phpbb_sitelist_seq;
910
911
CREATE TABLE phpbb_sitelist (
912
	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
913
	site_ip varchar(40) DEFAULT '' NOT NULL,
914
	site_hostname varchar(255) DEFAULT '' NOT NULL,
915
	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
916
	PRIMARY KEY (site_id)
917
);
918
919
920
/*
921
	Table: 'phpbb_smilies'
922
*/
923
CREATE SEQUENCE phpbb_smilies_seq;
924
925
CREATE TABLE phpbb_smilies (
926
	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
927
	code varchar(50) DEFAULT '' NOT NULL,
928
	emotion varchar(50) DEFAULT '' NOT NULL,
929
	smiley_url varchar(50) DEFAULT '' NOT NULL,
930
	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
931
	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
932
	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
933
	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
934
	PRIMARY KEY (smiley_id)
935
);
936
937
CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
938
939
/*
940
	Table: 'phpbb_styles'
941
*/
942
CREATE SEQUENCE phpbb_styles_seq;
943
944
CREATE TABLE phpbb_styles (
945
	style_id INT2 DEFAULT nextval('phpbb_styles_seq'),
946
	style_name varchar(255) DEFAULT '' NOT NULL,
947
	style_copyright varchar(255) DEFAULT '' NOT NULL,
948
	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
949
	template_id INT2 DEFAULT '0' NOT NULL CHECK (template_id >= 0),
950
	theme_id INT2 DEFAULT '0' NOT NULL CHECK (theme_id >= 0),
951
	imageset_id INT2 DEFAULT '0' NOT NULL CHECK (imageset_id >= 0),
952
	PRIMARY KEY (style_id)
953
);
954
955
CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
956
CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id);
957
CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id);
958
CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id);
959
960
/*
961
	Table: 'phpbb_styles_template'
962
*/
963
CREATE SEQUENCE phpbb_styles_template_seq;
964
965
CREATE TABLE phpbb_styles_template (
966
	template_id INT2 DEFAULT nextval('phpbb_styles_template_seq'),
967
	template_name varchar(255) DEFAULT '' NOT NULL,
968
	template_copyright varchar(255) DEFAULT '' NOT NULL,
969
	template_path varchar(100) DEFAULT '' NOT NULL,
970
	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
971
	template_storedb INT2 DEFAULT '0' NOT NULL CHECK (template_storedb >= 0),
972
	PRIMARY KEY (template_id)
973
);
974
975
CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (template_name);
976
977
/*
978
	Table: 'phpbb_styles_template_data'
979
*/
980
CREATE TABLE phpbb_styles_template_data (
981
	template_id INT2 DEFAULT '0' NOT NULL CHECK (template_id >= 0),
982
	template_filename varchar(100) DEFAULT '' NOT NULL,
983
	template_included varchar(8000) DEFAULT '' NOT NULL,
984
	template_mtime INT4 DEFAULT '0' NOT NULL CHECK (template_mtime >= 0),
985
	template_data TEXT DEFAULT '' NOT NULL
986
);
987
988
CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id);
989
CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename);
990
991
/*
992
	Table: 'phpbb_styles_theme'
993
*/
994
CREATE SEQUENCE phpbb_styles_theme_seq;
995
996
CREATE TABLE phpbb_styles_theme (
997
	theme_id INT2 DEFAULT nextval('phpbb_styles_theme_seq'),
998
	theme_name varchar(255) DEFAULT '' NOT NULL,
999
	theme_copyright varchar(255) DEFAULT '' NOT NULL,
1000
	theme_path varchar(100) DEFAULT '' NOT NULL,
1001
	theme_storedb INT2 DEFAULT '0' NOT NULL CHECK (theme_storedb >= 0),
1002
	theme_mtime INT4 DEFAULT '0' NOT NULL CHECK (theme_mtime >= 0),
1003
	theme_data TEXT DEFAULT '' NOT NULL,
1004
	PRIMARY KEY (theme_id)
1005
);
1006
1007
CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name);
1008
1009
/*
1010
	Table: 'phpbb_styles_imageset'
1011
*/
1012
CREATE SEQUENCE phpbb_styles_imageset_seq;
1013
1014
CREATE TABLE phpbb_styles_imageset (
1015
	imageset_id INT2 DEFAULT nextval('phpbb_styles_imageset_seq'),
1016
	imageset_name varchar(255) DEFAULT '' NOT NULL,
1017
	imageset_copyright varchar(255) DEFAULT '' NOT NULL,
1018
	imageset_path varchar(100) DEFAULT '' NOT NULL,
1019
	PRIMARY KEY (imageset_id)
1020
);
1021
1022
CREATE UNIQUE INDEX phpbb_styles_imageset_imgset_nm ON phpbb_styles_imageset (imageset_name);
1023
1024
/*
1025
	Table: 'phpbb_styles_imageset_data'
1026
*/
1027
CREATE SEQUENCE phpbb_styles_imageset_data_seq;
1028
1029
CREATE TABLE phpbb_styles_imageset_data (
1030
	image_id INT2 DEFAULT nextval('phpbb_styles_imageset_data_seq'),
1031
	image_name varchar(200) DEFAULT '' NOT NULL,
1032
	image_filename varchar(200) DEFAULT '' NOT NULL,
1033
	image_lang varchar(30) DEFAULT '' NOT NULL,
1034
	image_height INT2 DEFAULT '0' NOT NULL CHECK (image_height >= 0),
1035
	image_width INT2 DEFAULT '0' NOT NULL CHECK (image_width >= 0),
1036
	imageset_id INT2 DEFAULT '0' NOT NULL CHECK (imageset_id >= 0),
1037
	PRIMARY KEY (image_id)
1038
);
1039
1040
CREATE INDEX phpbb_styles_imageset_data_i_d ON phpbb_styles_imageset_data (imageset_id);
1041
1042
/*
1043
	Table: 'phpbb_topics'
1044
*/
1045
CREATE SEQUENCE phpbb_topics_seq;
1046
1047
CREATE TABLE phpbb_topics (
1048
	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
1049
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
1050
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
1051
	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
1052
	topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
1053
	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
1054
	topic_title varchar(100) DEFAULT '' NOT NULL,
1055
	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
1056
	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
1057
	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
1058
	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
1059
	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
1060
	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
1061
	topic_status INT2 DEFAULT '0' NOT NULL,
1062
	topic_type INT2 DEFAULT '0' NOT NULL,
1063
	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
1064
	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
1065
	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
1066
	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
1067
	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
1068
	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
1069
	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
1070
	topic_last_post_subject varchar(100) DEFAULT '' NOT NULL,
1071
	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
1072
	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
1073
	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
1074
	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
1075
	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
1076
	poll_title varchar(255) DEFAULT '' NOT NULL,
1077
	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
1078
	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
1079
	poll_max_options INT2 DEFAULT '1' NOT NULL,
1080
	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
1081
	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
1082
	PRIMARY KEY (topic_id)
1083
);
1084
1085
CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id);
1086
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type);
1087
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time);
1088
CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved);
1089
CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id);
1090
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id);
1091
1092
/*
1093
	Table: 'phpbb_topics_track'
1094
*/
1095
CREATE TABLE phpbb_topics_track (
1096
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1097
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
1098
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
1099
	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
1100
	PRIMARY KEY (user_id, topic_id)
1101
);
1102
1103
CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id);
1104
1105
/*
1106
	Table: 'phpbb_topics_posted'
1107
*/
1108
CREATE TABLE phpbb_topics_posted (
1109
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1110
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
1111
	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
1112
	PRIMARY KEY (user_id, topic_id)
1113
);
1114
1115
1116
/*
1117
	Table: 'phpbb_topics_watch'
1118
*/
1119
CREATE TABLE phpbb_topics_watch (
1120
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
1121
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1122
	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
1123
);
1124
1125
CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id);
1126
CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id);
1127
CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status);
1128
1129
/*
1130
	Table: 'phpbb_user_group'
1131
*/
1132
CREATE TABLE phpbb_user_group (
1133
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
1134
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1135
	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
1136
	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
1137
);
1138
1139
CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id);
1140
CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id);
1141
CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader);
1142
1143
/*
1144
	Table: 'phpbb_users'
1145
*/
1146
CREATE SEQUENCE phpbb_users_seq;
1147
1148
CREATE TABLE phpbb_users (
1149
	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
1150
	user_type INT2 DEFAULT '0' NOT NULL,
1151
	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
1152
	user_permissions TEXT DEFAULT '' NOT NULL,
1153
	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
1154
	user_ip varchar(40) DEFAULT '' NOT NULL,
1155
	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
1156
	username varchar_ci DEFAULT '' NOT NULL,
1157
	username_clean varchar_ci DEFAULT '' NOT NULL,
1158
	user_password varchar(40) DEFAULT '' NOT NULL,
1159
	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
1160
	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
1161
	user_email varchar(100) DEFAULT '' NOT NULL,
1162
	user_email_hash INT8 DEFAULT '0' NOT NULL,
1163
	user_birthday varchar(10) DEFAULT '' NOT NULL,
1164
	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
1165
	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
1166
	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
1167
	user_lastpage varchar(200) DEFAULT '' NOT NULL,
1168
	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
1169
	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
1170
	user_warnings INT2 DEFAULT '0' NOT NULL,
1171
	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
1172
	user_login_attempts INT2 DEFAULT '0' NOT NULL,
1173
	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
1174
	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
1175
	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
1176
	user_lang varchar(30) DEFAULT '' NOT NULL,
1177
	user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
1178
	user_dst INT2 DEFAULT '0' NOT NULL CHECK (user_dst >= 0),
1179
	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
1180
	user_style INT2 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
1181
	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
1182
	user_colour varchar(6) DEFAULT '' NOT NULL,
1183
	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
1184
	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
1185
	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
1186
	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
1187
	user_full_folder INT4 DEFAULT '-3' NOT NULL,
1188
	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
1189
	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
1190
	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
1191
	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
1192
	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
1193
	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
1194
	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
1195
	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
1196
	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
1197
	user_notify_type INT2 DEFAULT '0' NOT NULL,
1198
	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
1199
	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
1200
	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
1201
	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
1202
	user_options INT4 DEFAULT '895' NOT NULL CHECK (user_options >= 0),
1203
	user_avatar varchar(255) DEFAULT '' NOT NULL,
1204
	user_avatar_type INT2 DEFAULT '0' NOT NULL,
1205
	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
1206
	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
1207
	user_sig TEXT DEFAULT '' NOT NULL,
1208
	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
1209
	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
1210
	user_from varchar(100) DEFAULT '' NOT NULL,
1211
	user_icq varchar(15) DEFAULT '' NOT NULL,
1212
	user_aim varchar(255) DEFAULT '' NOT NULL,
1213
	user_yim varchar(255) DEFAULT '' NOT NULL,
1214
	user_msnm varchar(255) DEFAULT '' NOT NULL,
1215
	user_jabber varchar(255) DEFAULT '' NOT NULL,
1216
	user_website varchar(200) DEFAULT '' NOT NULL,
1217
	user_occ varchar(4000) DEFAULT '' NOT NULL,
1218
	user_interests varchar(4000) DEFAULT '' NOT NULL,
1219
	user_actkey varchar(32) DEFAULT '' NOT NULL,
1220
	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
1221
	user_form_salt varchar(32) DEFAULT '' NOT NULL,
1222
	PRIMARY KEY (user_id)
1223
);
1224
1225
CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday);
1226
CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash);
1227
CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type);
1228
CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
1229
1230
/*
1231
	Table: 'phpbb_warnings'
1232
*/
1233
CREATE SEQUENCE phpbb_warnings_seq;
1234
1235
CREATE TABLE phpbb_warnings (
1236
	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
1237
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1238
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
1239
	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
1240
	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
1241
	PRIMARY KEY (warning_id)
1242
);
1243
1244
1245
/*
1246
	Table: 'phpbb_words'
1247
*/
1248
CREATE SEQUENCE phpbb_words_seq;
1249
1250
CREATE TABLE phpbb_words (
1251
	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
1252
	word varchar(255) DEFAULT '' NOT NULL,
1253
	replacement varchar(255) DEFAULT '' NOT NULL,
1254
	PRIMARY KEY (word_id)
1255
);
1256
1257
1258
/*
1259
	Table: 'phpbb_zebra'
1260
*/
1261
CREATE TABLE phpbb_zebra (
1262
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
1263
	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
1264
	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
1265
	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
1266
	PRIMARY KEY (user_id, zebra_id)
1267
);
1268
1269
1270
1271
COMMIT;