From e8a9c0ae6d92822699de9a2d7fc1aae9377ade8a Mon Sep 17 00:00:00 2001
From: Igor Wiedler <igor@wiedler.ch>
Date: Sun, 8 Apr 2012 16:11:06 +0200
Subject: [feature/avatars] Fix avatar_type in create_schema_files

PHPBB3-10018
---
 phpBB/install/schemas/postgres_schema.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index c624024362..f139dc0ced 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -463,7 +463,7 @@ CREATE TABLE phpbb_groups (
 	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
 	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
 	group_avatar varchar(255) DEFAULT '' NOT NULL,
-	group_avatar_type INT2 DEFAULT '0' NOT NULL,
+	group_avatar_type varchar(32) DEFAULT '' NOT NULL,
 	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
 	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
 	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
@@ -1167,7 +1167,7 @@ CREATE TABLE phpbb_users (
 	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
 	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
 	user_avatar varchar(255) DEFAULT '' NOT NULL,
-	user_avatar_type INT2 DEFAULT '0' NOT NULL,
+	user_avatar_type varchar(32) DEFAULT '' NOT NULL,
 	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
 	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
 	user_sig TEXT DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From b8c55291ed7ed86565be2bc651bf20eb1a9ed4dd Mon Sep 17 00:00:00 2001
From: Josh Woody <a_jelly_doughnut@phpbb.com>
Date: Thu, 17 Jun 2010 23:58:18 -0500
Subject: [feature/soft-delete] Lay the groundwork for a soft-delete feature

So far, I've added no new functionality.  The biggest change here is adjusting the DB column names to "visibility" rather than "approved".  Some things here are pretty likely to change, for example the name and location of the topic_visibility class. Happy birthday phpBB :)

PHPBB3-9657
---
 phpBB/install/schemas/postgres_schema.sql | 2476 ++++++++++++++---------------
 1 file changed, 1236 insertions(+), 1240 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 659a32bf19..e1678c9cc5 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1,1240 +1,1236 @@
-/*
- * DO NOT EDIT THIS FILE, IT IS GENERATED
- *
- * To change the contents of this file, edit
- * phpBB/develop/create_schema_files.php and
- * run it.
- */
-
-BEGIN;
-
-/*
-	Domain definition
-*/
-CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
-
-/*
-	Operation Functions
-*/
-CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
-
-/*
-	Operators
-*/
-CREATE OPERATOR <(
-  PROCEDURE = _varchar_ci_less_than,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = >,
-  NEGATOR = >=,
-  RESTRICT = scalarltsel,
-  JOIN = scalarltjoinsel);
-
-CREATE OPERATOR <=(
-  PROCEDURE = _varchar_ci_less_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = >=,
-  NEGATOR = >,
-  RESTRICT = scalarltsel,
-  JOIN = scalarltjoinsel);
-
-CREATE OPERATOR >(
-  PROCEDURE = _varchar_ci_greater_than,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <,
-  NEGATOR = <=,
-  RESTRICT = scalargtsel,
-  JOIN = scalargtjoinsel);
-
-CREATE OPERATOR >=(
-  PROCEDURE = _varchar_ci_greater_equals,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <=,
-  NEGATOR = <,
-  RESTRICT = scalargtsel,
-  JOIN = scalargtjoinsel);
-
-CREATE OPERATOR <>(
-  PROCEDURE = _varchar_ci_not_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <>,
-  NEGATOR = =,
-  RESTRICT = neqsel,
-  JOIN = neqjoinsel);
-
-CREATE OPERATOR =(
-  PROCEDURE = _varchar_ci_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = =,
-  NEGATOR = <>,
-  RESTRICT = eqsel,
-  JOIN = eqjoinsel,
-  HASHES,
-  MERGES,
-  SORT1= <);
-
-/*
-	Table: 'phpbb_attachments'
-*/
-CREATE SEQUENCE phpbb_attachments_seq;
-
-CREATE TABLE phpbb_attachments (
-	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
-	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
-	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
-	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
-	physical_filename varchar(255) DEFAULT '' NOT NULL,
-	real_filename varchar(255) DEFAULT '' NOT NULL,
-	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
-	attach_comment varchar(4000) DEFAULT '' NOT NULL,
-	extension varchar(100) DEFAULT '' NOT NULL,
-	mimetype varchar(100) DEFAULT '' NOT NULL,
-	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
-	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
-	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
-	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);
-
-/*
-	Table: 'phpbb_acl_groups'
-*/
-CREATE TABLE phpbb_acl_groups (
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
-	auth_setting INT2 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 SEQUENCE phpbb_acl_options_seq;
-
-CREATE TABLE phpbb_acl_options (
-	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
-	auth_option varchar(50) DEFAULT '' NOT NULL,
-	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
-	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
-	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
-	PRIMARY KEY (auth_option_id)
-);
-
-CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
-
-/*
-	Table: 'phpbb_acl_roles'
-*/
-CREATE SEQUENCE phpbb_acl_roles_seq;
-
-CREATE TABLE phpbb_acl_roles (
-	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
-	role_name varchar(255) DEFAULT '' NOT NULL,
-	role_description varchar(4000) DEFAULT '' NOT NULL,
-	role_type varchar(10) DEFAULT '' NOT NULL,
-	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
-	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);
-
-/*
-	Table: 'phpbb_acl_roles_data'
-*/
-CREATE TABLE phpbb_acl_roles_data (
-	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_setting INT2 DEFAULT '0' NOT NULL,
-	PRIMARY KEY (role_id, auth_option_id)
-);
-
-CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
-
-/*
-	Table: 'phpbb_acl_users'
-*/
-CREATE TABLE phpbb_acl_users (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
-	auth_setting INT2 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 SEQUENCE phpbb_banlist_seq;
-
-CREATE TABLE phpbb_banlist (
-	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
-	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
-	ban_ip varchar(40) DEFAULT '' NOT NULL,
-	ban_email varchar(100) DEFAULT '' NOT NULL,
-	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
-	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
-	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
-	ban_reason varchar(255) DEFAULT '' NOT NULL,
-	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
-	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);
-
-/*
-	Table: 'phpbb_bbcodes'
-*/
-CREATE TABLE phpbb_bbcodes (
-	bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0),
-	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
-	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
-	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
-	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
-	bbcode_tpl TEXT DEFAULT '' NOT NULL,
-	first_pass_match TEXT DEFAULT '' NOT NULL,
-	first_pass_replace TEXT DEFAULT '' NOT NULL,
-	second_pass_match TEXT DEFAULT '' NOT NULL,
-	second_pass_replace TEXT DEFAULT '' NOT NULL,
-	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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	PRIMARY KEY (topic_id, user_id)
-);
-
-
-/*
-	Table: 'phpbb_bots'
-*/
-CREATE SEQUENCE phpbb_bots_seq;
-
-CREATE TABLE phpbb_bots (
-	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
-	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
-	bot_name varchar(255) DEFAULT '' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	bot_agent varchar(255) DEFAULT '' NOT NULL,
-	bot_ip varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (bot_id)
-);
-
-CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
-
-/*
-	Table: 'phpbb_config'
-*/
-CREATE TABLE phpbb_config (
-	config_name varchar(255) DEFAULT '' NOT NULL,
-	config_value varchar(255) DEFAULT '' NOT NULL,
-	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
-	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 '' NOT NULL,
-	session_id char(32) DEFAULT '' NOT NULL,
-	confirm_type INT2 DEFAULT '0' NOT NULL,
-	code varchar(8) DEFAULT '' NOT NULL,
-	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
-	attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0),
-	PRIMARY KEY (session_id, confirm_id)
-);
-
-CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
-
-/*
-	Table: 'phpbb_disallow'
-*/
-CREATE SEQUENCE phpbb_disallow_seq;
-
-CREATE TABLE phpbb_disallow (
-	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
-	disallow_username varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (disallow_id)
-);
-
-
-/*
-	Table: 'phpbb_drafts'
-*/
-CREATE SEQUENCE phpbb_drafts_seq;
-
-CREATE TABLE phpbb_drafts (
-	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
-	draft_subject varchar(255) DEFAULT '' NOT NULL,
-	draft_message TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (draft_id)
-);
-
-CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
-
-/*
-	Table: 'phpbb_ext'
-*/
-CREATE TABLE phpbb_ext (
-	ext_name varchar(255) DEFAULT '' NOT NULL,
-	ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0),
-	ext_state varchar(8000) DEFAULT '' NOT NULL
-);
-
-CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
-
-/*
-	Table: 'phpbb_extensions'
-*/
-CREATE SEQUENCE phpbb_extensions_seq;
-
-CREATE TABLE phpbb_extensions (
-	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	extension varchar(100) DEFAULT '' NOT NULL,
-	PRIMARY KEY (extension_id)
-);
-
-
-/*
-	Table: 'phpbb_extension_groups'
-*/
-CREATE SEQUENCE phpbb_extension_groups_seq;
-
-CREATE TABLE phpbb_extension_groups (
-	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
-	group_name varchar(255) DEFAULT '' NOT NULL,
-	cat_id INT2 DEFAULT '0' NOT NULL,
-	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
-	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
-	upload_icon varchar(255) DEFAULT '' NOT NULL,
-	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
-	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
-	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
-	PRIMARY KEY (group_id)
-);
-
-
-/*
-	Table: 'phpbb_forums'
-*/
-CREATE SEQUENCE phpbb_forums_seq;
-
-CREATE TABLE phpbb_forums (
-	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
-	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
-	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
-	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
-	forum_parents TEXT DEFAULT '' NOT NULL,
-	forum_name varchar(255) DEFAULT '' NOT NULL,
-	forum_desc varchar(4000) DEFAULT '' NOT NULL,
-	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
-	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
-	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
-	forum_link varchar(255) DEFAULT '' NOT NULL,
-	forum_password varchar(40) DEFAULT '' NOT NULL,
-	forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
-	forum_image varchar(255) DEFAULT '' NOT NULL,
-	forum_rules varchar(4000) DEFAULT '' NOT NULL,
-	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
-	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
-	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
-	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
-	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
-	forum_type INT2 DEFAULT '0' NOT NULL,
-	forum_status INT2 DEFAULT '0' NOT NULL,
-	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
-	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
-	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
-	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
-	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
-	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
-	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
-	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
-	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	forum_flags INT2 DEFAULT '32' NOT NULL,
-	forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
-	display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
-	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
-	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
-	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
-	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
-	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
-	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
-	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
-	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
-	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);
-
-/*
-	Table: 'phpbb_forums_access'
-*/
-CREATE TABLE phpbb_forums_access (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	session_id char(32) DEFAULT '' NOT NULL,
-	PRIMARY KEY (forum_id, user_id, session_id)
-);
-
-
-/*
-	Table: 'phpbb_forums_track'
-*/
-CREATE TABLE phpbb_forums_track (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
-	PRIMARY KEY (user_id, forum_id)
-);
-
-
-/*
-	Table: 'phpbb_forums_watch'
-*/
-CREATE TABLE phpbb_forums_watch (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
-);
-
-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 SEQUENCE phpbb_groups_seq;
-
-CREATE TABLE phpbb_groups (
-	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
-	group_type INT2 DEFAULT '1' NOT NULL,
-	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
-	group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0),
-	group_name varchar_ci DEFAULT '' NOT NULL,
-	group_desc varchar(4000) DEFAULT '' NOT NULL,
-	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
-	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
-	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
-	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
-	group_avatar varchar(255) DEFAULT '' NOT NULL,
-	group_avatar_type INT2 DEFAULT '0' NOT NULL,
-	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
-	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
-	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
-	group_colour varchar(6) DEFAULT '' NOT NULL,
-	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
-	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
-	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
-	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
-	group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
-	group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
-	PRIMARY KEY (group_id)
-);
-
-CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
-
-/*
-	Table: 'phpbb_icons'
-*/
-CREATE SEQUENCE phpbb_icons_seq;
-
-CREATE TABLE phpbb_icons (
-	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
-	icons_url varchar(255) DEFAULT '' NOT NULL,
-	icons_width INT2 DEFAULT '0' NOT NULL,
-	icons_height INT2 DEFAULT '0' NOT NULL,
-	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
-	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
-	PRIMARY KEY (icons_id)
-);
-
-CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
-
-/*
-	Table: 'phpbb_lang'
-*/
-CREATE SEQUENCE phpbb_lang_seq;
-
-CREATE TABLE phpbb_lang (
-	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
-	lang_iso varchar(30) DEFAULT '' NOT NULL,
-	lang_dir varchar(30) DEFAULT '' NOT NULL,
-	lang_english_name varchar(100) DEFAULT '' NOT NULL,
-	lang_local_name varchar(255) DEFAULT '' NOT NULL,
-	lang_author varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (lang_id)
-);
-
-CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
-
-/*
-	Table: 'phpbb_log'
-*/
-CREATE SEQUENCE phpbb_log_seq;
-
-CREATE TABLE phpbb_log (
-	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
-	log_type INT2 DEFAULT '0' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
-	log_ip varchar(40) DEFAULT '' NOT NULL,
-	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
-	log_operation varchar(4000) DEFAULT '' NOT NULL,
-	log_data TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (log_id)
-);
-
-CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
-CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time);
-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);
-
-/*
-	Table: 'phpbb_login_attempts'
-*/
-CREATE TABLE phpbb_login_attempts (
-	attempt_ip varchar(40) DEFAULT '' NOT NULL,
-	attempt_browser varchar(150) DEFAULT '' NOT NULL,
-	attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
-	attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	username varchar(255) DEFAULT '0' NOT NULL,
-	username_clean varchar_ci DEFAULT '0' NOT NULL
-);
-
-CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
-CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time);
-CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
-CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
-
-/*
-	Table: 'phpbb_moderator_cache'
-*/
-CREATE TABLE phpbb_moderator_cache (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	username varchar(255) DEFAULT '' NOT NULL,
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	group_name varchar(255) DEFAULT '' NOT NULL,
-	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
-);
-
-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 SEQUENCE phpbb_modules_seq;
-
-CREATE TABLE phpbb_modules (
-	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
-	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
-	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
-	module_basename varchar(255) DEFAULT '' NOT NULL,
-	module_class varchar(10) DEFAULT '' NOT NULL,
-	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
-	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
-	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
-	module_langname varchar(255) DEFAULT '' NOT NULL,
-	module_mode varchar(255) DEFAULT '' NOT NULL,
-	module_auth varchar(255) DEFAULT '' NOT NULL,
-	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);
-
-/*
-	Table: 'phpbb_poll_options'
-*/
-CREATE TABLE phpbb_poll_options (
-	poll_option_id INT2 DEFAULT '0' NOT NULL,
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
-	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
-);
-
-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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	poll_option_id INT2 DEFAULT '0' NOT NULL,
-	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
-	vote_user_ip varchar(40) DEFAULT '' NOT NULL
-);
-
-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 SEQUENCE phpbb_posts_seq;
-
-CREATE TABLE phpbb_posts (
-	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	poster_ip varchar(40) DEFAULT '' NOT NULL,
-	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
-	post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
-	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
-	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
-	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
-	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
-	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
-	post_username varchar(255) DEFAULT '' NOT NULL,
-	post_subject varchar(255) DEFAULT '' NOT NULL,
-	post_text TEXT DEFAULT '' NOT NULL,
-	post_checksum varchar(32) DEFAULT '' NOT NULL,
-	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
-	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
-	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
-	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
-	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
-	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
-	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
-	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_post_username ON phpbb_posts (post_username);
-CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
-
-/*
-	Table: 'phpbb_privmsgs'
-*/
-CREATE SEQUENCE phpbb_privmsgs_seq;
-
-CREATE TABLE phpbb_privmsgs (
-	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
-	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
-	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	author_ip varchar(40) DEFAULT '' NOT NULL,
-	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
-	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
-	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
-	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
-	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
-	message_subject varchar(255) DEFAULT '' NOT NULL,
-	message_text TEXT DEFAULT '' NOT NULL,
-	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
-	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
-	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
-	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
-	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
-	to_address varchar(4000) DEFAULT '' NOT NULL,
-	bcc_address varchar(4000) DEFAULT '' NOT NULL,
-	message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0),
-	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);
-
-/*
-	Table: 'phpbb_privmsgs_folder'
-*/
-CREATE SEQUENCE phpbb_privmsgs_folder_seq;
-
-CREATE TABLE phpbb_privmsgs_folder (
-	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	folder_name varchar(255) DEFAULT '' NOT NULL,
-	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
-	PRIMARY KEY (folder_id)
-);
-
-CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
-
-/*
-	Table: 'phpbb_privmsgs_rules'
-*/
-CREATE SEQUENCE phpbb_privmsgs_rules_seq;
-
-CREATE TABLE phpbb_privmsgs_rules (
-	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
-	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
-	rule_string varchar(255) DEFAULT '' NOT NULL,
-	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
-	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
-	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
-	rule_folder_id INT4 DEFAULT '0' NOT NULL,
-	PRIMARY KEY (rule_id)
-);
-
-CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
-
-/*
-	Table: 'phpbb_privmsgs_to'
-*/
-CREATE TABLE phpbb_privmsgs_to (
-	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
-	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
-	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
-	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
-	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
-	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
-	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
-	folder_id INT4 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 SEQUENCE phpbb_profile_fields_seq;
-
-CREATE TABLE phpbb_profile_fields (
-	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
-	field_name varchar(255) DEFAULT '' NOT NULL,
-	field_type INT2 DEFAULT '0' NOT NULL,
-	field_ident varchar(20) DEFAULT '' NOT NULL,
-	field_length varchar(20) DEFAULT '' NOT NULL,
-	field_minlen varchar(255) DEFAULT '' NOT NULL,
-	field_maxlen varchar(255) DEFAULT '' NOT NULL,
-	field_novalue varchar(255) DEFAULT '' NOT NULL,
-	field_default_value varchar(255) DEFAULT '' NOT NULL,
-	field_validation varchar(20) DEFAULT '' NOT NULL,
-	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
-	field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0),
-	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
-	field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0),
-	field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
-	field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
-	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
-	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
-	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
-	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
-	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);
-
-/*
-	Table: 'phpbb_profile_fields_data'
-*/
-CREATE TABLE phpbb_profile_fields_data (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	PRIMARY KEY (user_id)
-);
-
-
-/*
-	Table: 'phpbb_profile_fields_lang'
-*/
-CREATE TABLE phpbb_profile_fields_lang (
-	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
-	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
-	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
-	field_type INT2 DEFAULT '0' NOT NULL,
-	lang_value varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (field_id, lang_id, option_id)
-);
-
-
-/*
-	Table: 'phpbb_profile_lang'
-*/
-CREATE TABLE phpbb_profile_lang (
-	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
-	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
-	lang_name varchar(255) DEFAULT '' NOT NULL,
-	lang_explain varchar(4000) DEFAULT '' NOT NULL,
-	lang_default_value varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (field_id, lang_id)
-);
-
-
-/*
-	Table: 'phpbb_ranks'
-*/
-CREATE SEQUENCE phpbb_ranks_seq;
-
-CREATE TABLE phpbb_ranks (
-	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
-	rank_title varchar(255) DEFAULT '' NOT NULL,
-	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
-	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
-	rank_image varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (rank_id)
-);
-
-
-/*
-	Table: 'phpbb_reports'
-*/
-CREATE SEQUENCE phpbb_reports_seq;
-
-CREATE TABLE phpbb_reports (
-	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
-	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
-	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
-	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
-	report_text TEXT DEFAULT '' NOT NULL,
-	reported_post_text TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (report_id)
-);
-
-CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
-CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
-
-/*
-	Table: 'phpbb_reports_reasons'
-*/
-CREATE SEQUENCE phpbb_reports_reasons_seq;
-
-CREATE TABLE phpbb_reports_reasons (
-	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
-	reason_title varchar(255) DEFAULT '' NOT NULL,
-	reason_description TEXT DEFAULT '' NOT NULL,
-	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
-	PRIMARY KEY (reason_id)
-);
-
-
-/*
-	Table: 'phpbb_search_results'
-*/
-CREATE TABLE phpbb_search_results (
-	search_key varchar(32) DEFAULT '' NOT NULL,
-	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
-	search_keywords TEXT DEFAULT '' NOT NULL,
-	search_authors TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (search_key)
-);
-
-
-/*
-	Table: 'phpbb_search_wordlist'
-*/
-CREATE SEQUENCE phpbb_search_wordlist_seq;
-
-CREATE TABLE phpbb_search_wordlist (
-	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
-	word_text varchar(255) DEFAULT '' NOT NULL,
-	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
-	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
-	PRIMARY KEY (word_id)
-);
-
-CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
-CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
-
-/*
-	Table: 'phpbb_search_wordmatch'
-*/
-CREATE TABLE phpbb_search_wordmatch (
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
-	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
-);
-
-CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (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 '' NOT NULL,
-	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
-	session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0),
-	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
-	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
-	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
-	session_ip varchar(40) DEFAULT '' NOT NULL,
-	session_browser varchar(150) DEFAULT '' NOT NULL,
-	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
-	session_page varchar(255) DEFAULT '' NOT NULL,
-	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
-	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
-	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
-	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);
-CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id);
-
-/*
-	Table: 'phpbb_sessions_keys'
-*/
-CREATE TABLE phpbb_sessions_keys (
-	key_id char(32) DEFAULT '' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	last_ip varchar(40) DEFAULT '' NOT NULL,
-	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
-	PRIMARY KEY (key_id, user_id)
-);
-
-CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
-
-/*
-	Table: 'phpbb_sitelist'
-*/
-CREATE SEQUENCE phpbb_sitelist_seq;
-
-CREATE TABLE phpbb_sitelist (
-	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
-	site_ip varchar(40) DEFAULT '' NOT NULL,
-	site_hostname varchar(255) DEFAULT '' NOT NULL,
-	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
-	PRIMARY KEY (site_id)
-);
-
-
-/*
-	Table: 'phpbb_smilies'
-*/
-CREATE SEQUENCE phpbb_smilies_seq;
-
-CREATE TABLE phpbb_smilies (
-	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
-	code varchar(50) DEFAULT '' NOT NULL,
-	emotion varchar(50) DEFAULT '' NOT NULL,
-	smiley_url varchar(50) DEFAULT '' NOT NULL,
-	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
-	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
-	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
-	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
-	PRIMARY KEY (smiley_id)
-);
-
-CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
-
-/*
-	Table: 'phpbb_styles'
-*/
-CREATE SEQUENCE phpbb_styles_seq;
-
-CREATE TABLE phpbb_styles (
-	style_id INT4 DEFAULT nextval('phpbb_styles_seq'),
-	style_name varchar(255) DEFAULT '' NOT NULL,
-	style_copyright varchar(255) DEFAULT '' NOT NULL,
-	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
-	style_path varchar(100) DEFAULT '' NOT NULL,
-	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
-	style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0),
-	style_parent_tree varchar(8000) DEFAULT '' NOT NULL,
-	PRIMARY KEY (style_id)
-);
-
-CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
-
-/*
-	Table: 'phpbb_topics'
-*/
-CREATE SEQUENCE phpbb_topics_seq;
-
-CREATE TABLE phpbb_topics (
-	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
-	topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
-	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
-	topic_title varchar(255) DEFAULT '' NOT NULL,
-	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
-	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
-	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
-	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
-	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
-	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
-	topic_status INT2 DEFAULT '0' NOT NULL,
-	topic_type INT2 DEFAULT '0' NOT NULL,
-	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
-	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
-	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
-	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
-	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
-	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	topic_last_post_subject varchar(255) DEFAULT '' NOT NULL,
-	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
-	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
-	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
-	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
-	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
-	poll_title varchar(255) DEFAULT '' NOT NULL,
-	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
-	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
-	poll_max_options INT2 DEFAULT '1' NOT NULL,
-	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
-	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
-	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);
-
-/*
-	Table: 'phpbb_topics_track'
-*/
-CREATE TABLE phpbb_topics_track (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
-	PRIMARY KEY (user_id, topic_id)
-);
-
-CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (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 INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
-	PRIMARY KEY (user_id, topic_id)
-);
-
-
-/*
-	Table: 'phpbb_topics_watch'
-*/
-CREATE TABLE phpbb_topics_watch (
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
-);
-
-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 INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
-	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
-);
-
-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 SEQUENCE phpbb_users_seq;
-
-CREATE TABLE phpbb_users (
-	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
-	user_type INT2 DEFAULT '0' NOT NULL,
-	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
-	user_permissions TEXT DEFAULT '' NOT NULL,
-	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
-	user_ip varchar(40) DEFAULT '' NOT NULL,
-	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
-	username varchar_ci DEFAULT '' NOT NULL,
-	username_clean varchar_ci DEFAULT '' NOT NULL,
-	user_password varchar(40) DEFAULT '' NOT NULL,
-	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
-	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
-	user_email varchar(100) DEFAULT '' NOT NULL,
-	user_email_hash INT8 DEFAULT '0' NOT NULL,
-	user_birthday varchar(10) DEFAULT '' NOT NULL,
-	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
-	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
-	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
-	user_lastpage varchar(200) DEFAULT '' NOT NULL,
-	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
-	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
-	user_warnings INT2 DEFAULT '0' NOT NULL,
-	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
-	user_login_attempts INT2 DEFAULT '0' NOT NULL,
-	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
-	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
-	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
-	user_lang varchar(30) DEFAULT '' NOT NULL,
-	user_timezone varchar(100) DEFAULT 'UTC' NOT NULL,
-	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
-	user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
-	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
-	user_colour varchar(6) DEFAULT '' NOT NULL,
-	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
-	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
-	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
-	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
-	user_full_folder INT4 DEFAULT '-3' NOT NULL,
-	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
-	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
-	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
-	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
-	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
-	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
-	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
-	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
-	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
-	user_notify_type INT2 DEFAULT '0' NOT NULL,
-	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
-	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
-	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
-	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
-	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
-	user_avatar varchar(255) DEFAULT '' NOT NULL,
-	user_avatar_type INT2 DEFAULT '0' NOT NULL,
-	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
-	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
-	user_sig TEXT DEFAULT '' NOT NULL,
-	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	user_from varchar(100) DEFAULT '' NOT NULL,
-	user_icq varchar(15) DEFAULT '' NOT NULL,
-	user_aim varchar(255) DEFAULT '' NOT NULL,
-	user_yim varchar(255) DEFAULT '' NOT NULL,
-	user_msnm varchar(255) DEFAULT '' NOT NULL,
-	user_jabber varchar(255) DEFAULT '' NOT NULL,
-	user_website varchar(200) DEFAULT '' NOT NULL,
-	user_occ varchar(4000) DEFAULT '' NOT NULL,
-	user_interests varchar(4000) DEFAULT '' NOT NULL,
-	user_actkey varchar(32) DEFAULT '' NOT NULL,
-	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
-	user_form_salt varchar(32) DEFAULT '' NOT NULL,
-	user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0),
-	user_reminded INT2 DEFAULT '0' NOT NULL,
-	user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0),
-	PRIMARY KEY (user_id)
-);
-
-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 UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
-
-/*
-	Table: 'phpbb_warnings'
-*/
-CREATE SEQUENCE phpbb_warnings_seq;
-
-CREATE TABLE phpbb_warnings (
-	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
-	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
-	PRIMARY KEY (warning_id)
-);
-
-
-/*
-	Table: 'phpbb_words'
-*/
-CREATE SEQUENCE phpbb_words_seq;
-
-CREATE TABLE phpbb_words (
-	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
-	word varchar(255) DEFAULT '' NOT NULL,
-	replacement varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (word_id)
-);
-
-
-/*
-	Table: 'phpbb_zebra'
-*/
-CREATE TABLE phpbb_zebra (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
-	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
-	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
-	PRIMARY KEY (user_id, zebra_id)
-);
-
-
-
-COMMIT;
\ No newline at end of file
+/*
+ * DO NOT EDIT THIS FILE, IT IS GENERATED
+ *
+ * To change the contents of this file, edit
+ * phpBB/develop/create_schema_files.php and
+ * run it.
+ */
+
+BEGIN;
+
+/*
+	Domain definition
+*/
+CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
+
+/*
+	Operation Functions
+*/
+CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
+
+/*
+	Operators
+*/
+CREATE OPERATOR <(
+  PROCEDURE = _varchar_ci_less_than,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = >,
+  NEGATOR = >=,
+  RESTRICT = scalarltsel,
+  JOIN = scalarltjoinsel);
+
+CREATE OPERATOR <=(
+  PROCEDURE = _varchar_ci_less_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = >=,
+  NEGATOR = >,
+  RESTRICT = scalarltsel,
+  JOIN = scalarltjoinsel);
+
+CREATE OPERATOR >(
+  PROCEDURE = _varchar_ci_greater_than,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <,
+  NEGATOR = <=,
+  RESTRICT = scalargtsel,
+  JOIN = scalargtjoinsel);
+
+CREATE OPERATOR >=(
+  PROCEDURE = _varchar_ci_greater_equals,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <=,
+  NEGATOR = <,
+  RESTRICT = scalargtsel,
+  JOIN = scalargtjoinsel);
+
+CREATE OPERATOR <>(
+  PROCEDURE = _varchar_ci_not_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <>,
+  NEGATOR = =,
+  RESTRICT = neqsel,
+  JOIN = neqjoinsel);
+
+CREATE OPERATOR =(
+  PROCEDURE = _varchar_ci_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = =,
+  NEGATOR = <>,
+  RESTRICT = eqsel,
+  JOIN = eqjoinsel,
+  HASHES,
+  MERGES,
+  SORT1= <);
+
+/*
+	Table: 'phpbb_attachments'
+*/
+CREATE SEQUENCE phpbb_attachments_seq;
+
+CREATE TABLE phpbb_attachments (
+	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
+	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
+	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
+	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
+	physical_filename varchar(255) DEFAULT '' NOT NULL,
+	real_filename varchar(255) DEFAULT '' NOT NULL,
+	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
+	attach_comment varchar(4000) DEFAULT '' NOT NULL,
+	extension varchar(100) DEFAULT '' NOT NULL,
+	mimetype varchar(100) DEFAULT '' NOT NULL,
+	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
+	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
+	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
+	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);
+
+/*
+	Table: 'phpbb_acl_groups'
+*/
+CREATE TABLE phpbb_acl_groups (
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
+	auth_setting INT2 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 SEQUENCE phpbb_acl_options_seq;
+
+CREATE TABLE phpbb_acl_options (
+	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
+	auth_option varchar(50) DEFAULT '' NOT NULL,
+	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
+	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
+	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
+	PRIMARY KEY (auth_option_id)
+);
+
+CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
+
+/*
+	Table: 'phpbb_acl_roles'
+*/
+CREATE SEQUENCE phpbb_acl_roles_seq;
+
+CREATE TABLE phpbb_acl_roles (
+	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
+	role_name varchar(255) DEFAULT '' NOT NULL,
+	role_description varchar(4000) DEFAULT '' NOT NULL,
+	role_type varchar(10) DEFAULT '' NOT NULL,
+	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
+	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);
+
+/*
+	Table: 'phpbb_acl_roles_data'
+*/
+CREATE TABLE phpbb_acl_roles_data (
+	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_setting INT2 DEFAULT '0' NOT NULL,
+	PRIMARY KEY (role_id, auth_option_id)
+);
+
+CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
+
+/*
+	Table: 'phpbb_acl_users'
+*/
+CREATE TABLE phpbb_acl_users (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
+	auth_setting INT2 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 SEQUENCE phpbb_banlist_seq;
+
+CREATE TABLE phpbb_banlist (
+	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
+	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
+	ban_ip varchar(40) DEFAULT '' NOT NULL,
+	ban_email varchar(100) DEFAULT '' NOT NULL,
+	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
+	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
+	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
+	ban_reason varchar(255) DEFAULT '' NOT NULL,
+	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
+	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);
+
+/*
+	Table: 'phpbb_bbcodes'
+*/
+CREATE TABLE phpbb_bbcodes (
+	bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0),
+	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
+	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
+	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
+	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
+	bbcode_tpl TEXT DEFAULT '' NOT NULL,
+	first_pass_match TEXT DEFAULT '' NOT NULL,
+	first_pass_replace TEXT DEFAULT '' NOT NULL,
+	second_pass_match TEXT DEFAULT '' NOT NULL,
+	second_pass_replace TEXT DEFAULT '' NOT NULL,
+	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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	PRIMARY KEY (topic_id, user_id)
+);
+
+
+/*
+	Table: 'phpbb_bots'
+*/
+CREATE SEQUENCE phpbb_bots_seq;
+
+CREATE TABLE phpbb_bots (
+	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
+	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
+	bot_name varchar(255) DEFAULT '' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	bot_agent varchar(255) DEFAULT '' NOT NULL,
+	bot_ip varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (bot_id)
+);
+
+CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
+
+/*
+	Table: 'phpbb_config'
+*/
+CREATE TABLE phpbb_config (
+	config_name varchar(255) DEFAULT '' NOT NULL,
+	config_value varchar(255) DEFAULT '' NOT NULL,
+	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
+	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 '' NOT NULL,
+	session_id char(32) DEFAULT '' NOT NULL,
+	confirm_type INT2 DEFAULT '0' NOT NULL,
+	code varchar(8) DEFAULT '' NOT NULL,
+	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
+	attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0),
+	PRIMARY KEY (session_id, confirm_id)
+);
+
+CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
+
+/*
+	Table: 'phpbb_disallow'
+*/
+CREATE SEQUENCE phpbb_disallow_seq;
+
+CREATE TABLE phpbb_disallow (
+	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
+	disallow_username varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (disallow_id)
+);
+
+
+/*
+	Table: 'phpbb_drafts'
+*/
+CREATE SEQUENCE phpbb_drafts_seq;
+
+CREATE TABLE phpbb_drafts (
+	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
+	draft_subject varchar(255) DEFAULT '' NOT NULL,
+	draft_message TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (draft_id)
+);
+
+CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
+
+/*
+	Table: 'phpbb_ext'
+*/
+CREATE TABLE phpbb_ext (
+	ext_name varchar(255) DEFAULT '' NOT NULL,
+	ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0),
+	ext_state varchar(8000) DEFAULT '' NOT NULL
+);
+
+CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
+
+/*
+	Table: 'phpbb_extensions'
+*/
+CREATE SEQUENCE phpbb_extensions_seq;
+
+CREATE TABLE phpbb_extensions (
+	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	extension varchar(100) DEFAULT '' NOT NULL,
+	PRIMARY KEY (extension_id)
+);
+
+
+/*
+	Table: 'phpbb_extension_groups'
+*/
+CREATE SEQUENCE phpbb_extension_groups_seq;
+
+CREATE TABLE phpbb_extension_groups (
+	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
+	group_name varchar(255) DEFAULT '' NOT NULL,
+	cat_id INT2 DEFAULT '0' NOT NULL,
+	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
+	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
+	upload_icon varchar(255) DEFAULT '' NOT NULL,
+	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
+	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
+	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
+	PRIMARY KEY (group_id)
+);
+
+
+/*
+	Table: 'phpbb_forums'
+*/
+CREATE SEQUENCE phpbb_forums_seq;
+
+CREATE TABLE phpbb_forums (
+	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
+	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
+	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
+	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
+	forum_parents TEXT DEFAULT '' NOT NULL,
+	forum_name varchar(255) DEFAULT '' NOT NULL,
+	forum_desc varchar(4000) DEFAULT '' NOT NULL,
+	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
+	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
+	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
+	forum_link varchar(255) DEFAULT '' NOT NULL,
+	forum_password varchar(40) DEFAULT '' NOT NULL,
+	forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
+	forum_image varchar(255) DEFAULT '' NOT NULL,
+	forum_rules varchar(4000) DEFAULT '' NOT NULL,
+	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
+	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
+	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
+	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
+	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
+	forum_type INT2 DEFAULT '0' NOT NULL,
+	forum_status INT2 DEFAULT '0' NOT NULL,
+	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
+	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
+	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
+	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
+	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
+	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
+	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
+	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
+	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	forum_flags INT2 DEFAULT '32' NOT NULL,
+	forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
+	display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
+	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
+	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
+	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
+	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
+	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
+	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
+	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
+	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
+	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);
+
+/*
+	Table: 'phpbb_forums_access'
+*/
+CREATE TABLE phpbb_forums_access (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	session_id char(32) DEFAULT '' NOT NULL,
+	PRIMARY KEY (forum_id, user_id, session_id)
+);
+
+
+/*
+	Table: 'phpbb_forums_track'
+*/
+CREATE TABLE phpbb_forums_track (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
+	PRIMARY KEY (user_id, forum_id)
+);
+
+
+/*
+	Table: 'phpbb_forums_watch'
+*/
+CREATE TABLE phpbb_forums_watch (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
+);
+
+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 SEQUENCE phpbb_groups_seq;
+
+CREATE TABLE phpbb_groups (
+	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
+	group_type INT2 DEFAULT '1' NOT NULL,
+	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
+	group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0),
+	group_name varchar_ci DEFAULT '' NOT NULL,
+	group_desc varchar(4000) DEFAULT '' NOT NULL,
+	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
+	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
+	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
+	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
+	group_avatar varchar(255) DEFAULT '' NOT NULL,
+	group_avatar_type INT2 DEFAULT '0' NOT NULL,
+	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
+	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
+	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
+	group_colour varchar(6) DEFAULT '' NOT NULL,
+	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
+	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
+	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
+	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
+	group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
+	group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
+	PRIMARY KEY (group_id)
+);
+
+CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
+
+/*
+	Table: 'phpbb_icons'
+*/
+CREATE SEQUENCE phpbb_icons_seq;
+
+CREATE TABLE phpbb_icons (
+	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
+	icons_url varchar(255) DEFAULT '' NOT NULL,
+	icons_width INT2 DEFAULT '0' NOT NULL,
+	icons_height INT2 DEFAULT '0' NOT NULL,
+	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
+	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
+	PRIMARY KEY (icons_id)
+);
+
+CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
+
+/*
+	Table: 'phpbb_lang'
+*/
+CREATE SEQUENCE phpbb_lang_seq;
+
+CREATE TABLE phpbb_lang (
+	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
+	lang_iso varchar(30) DEFAULT '' NOT NULL,
+	lang_dir varchar(30) DEFAULT '' NOT NULL,
+	lang_english_name varchar(100) DEFAULT '' NOT NULL,
+	lang_local_name varchar(255) DEFAULT '' NOT NULL,
+	lang_author varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (lang_id)
+);
+
+CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
+
+/*
+	Table: 'phpbb_log'
+*/
+CREATE SEQUENCE phpbb_log_seq;
+
+CREATE TABLE phpbb_log (
+	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
+	log_type INT2 DEFAULT '0' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
+	log_ip varchar(40) DEFAULT '' NOT NULL,
+	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
+	log_operation varchar(4000) DEFAULT '' NOT NULL,
+	log_data TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (log_id)
+);
+
+CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
+CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time);
+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);
+
+/*
+	Table: 'phpbb_login_attempts'
+*/
+CREATE TABLE phpbb_login_attempts (
+	attempt_ip varchar(40) DEFAULT '' NOT NULL,
+	attempt_browser varchar(150) DEFAULT '' NOT NULL,
+	attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
+	attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	username varchar(255) DEFAULT '0' NOT NULL,
+	username_clean varchar_ci DEFAULT '0' NOT NULL
+);
+
+CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
+CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time);
+CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
+CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
+
+/*
+	Table: 'phpbb_moderator_cache'
+*/
+CREATE TABLE phpbb_moderator_cache (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	username varchar(255) DEFAULT '' NOT NULL,
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	group_name varchar(255) DEFAULT '' NOT NULL,
+	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
+);
+
+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 SEQUENCE phpbb_modules_seq;
+
+CREATE TABLE phpbb_modules (
+	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
+	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
+	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
+	module_basename varchar(255) DEFAULT '' NOT NULL,
+	module_class varchar(10) DEFAULT '' NOT NULL,
+	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
+	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
+	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
+	module_langname varchar(255) DEFAULT '' NOT NULL,
+	module_mode varchar(255) DEFAULT '' NOT NULL,
+	module_auth varchar(255) DEFAULT '' NOT NULL,
+	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);
+
+/*
+	Table: 'phpbb_poll_options'
+*/
+CREATE TABLE phpbb_poll_options (
+	poll_option_id INT2 DEFAULT '0' NOT NULL,
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
+	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
+);
+
+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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	poll_option_id INT2 DEFAULT '0' NOT NULL,
+	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
+	vote_user_ip varchar(40) DEFAULT '' NOT NULL
+);
+
+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 SEQUENCE phpbb_posts_seq;
+
+CREATE TABLE phpbb_posts (
+	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	poster_ip varchar(40) DEFAULT '' NOT NULL,
+	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
+	post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
+	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
+	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
+	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
+	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
+	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
+	post_username varchar(255) DEFAULT '' NOT NULL,
+	post_subject varchar(255) DEFAULT '' NOT NULL,
+	post_text TEXT DEFAULT '' NOT NULL,
+	post_checksum varchar(32) DEFAULT '' NOT NULL,
+	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
+	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
+	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
+	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
+	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
+	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
+	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
+	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_post_username ON phpbb_posts (post_username);
+CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
+
+/*
+	Table: 'phpbb_privmsgs'
+*/
+CREATE SEQUENCE phpbb_privmsgs_seq;
+
+CREATE TABLE phpbb_privmsgs (
+	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
+	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
+	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	author_ip varchar(40) DEFAULT '' NOT NULL,
+	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
+	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
+	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
+	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
+	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
+	message_subject varchar(255) DEFAULT '' NOT NULL,
+	message_text TEXT DEFAULT '' NOT NULL,
+	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
+	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
+	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
+	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
+	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
+	to_address varchar(4000) DEFAULT '' NOT NULL,
+	bcc_address varchar(4000) DEFAULT '' NOT NULL,
+	message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0),
+	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);
+
+/*
+	Table: 'phpbb_privmsgs_folder'
+*/
+CREATE SEQUENCE phpbb_privmsgs_folder_seq;
+
+CREATE TABLE phpbb_privmsgs_folder (
+	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	folder_name varchar(255) DEFAULT '' NOT NULL,
+	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
+	PRIMARY KEY (folder_id)
+);
+
+CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
+
+/*
+	Table: 'phpbb_privmsgs_rules'
+*/
+CREATE SEQUENCE phpbb_privmsgs_rules_seq;
+
+CREATE TABLE phpbb_privmsgs_rules (
+	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
+	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
+	rule_string varchar(255) DEFAULT '' NOT NULL,
+	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
+	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
+	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
+	rule_folder_id INT4 DEFAULT '0' NOT NULL,
+	PRIMARY KEY (rule_id)
+);
+
+CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
+
+/*
+	Table: 'phpbb_privmsgs_to'
+*/
+CREATE TABLE phpbb_privmsgs_to (
+	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
+	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
+	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
+	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
+	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
+	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
+	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
+	folder_id INT4 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 SEQUENCE phpbb_profile_fields_seq;
+
+CREATE TABLE phpbb_profile_fields (
+	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
+	field_name varchar(255) DEFAULT '' NOT NULL,
+	field_type INT2 DEFAULT '0' NOT NULL,
+	field_ident varchar(20) DEFAULT '' NOT NULL,
+	field_length varchar(20) DEFAULT '' NOT NULL,
+	field_minlen varchar(255) DEFAULT '' NOT NULL,
+	field_maxlen varchar(255) DEFAULT '' NOT NULL,
+	field_novalue varchar(255) DEFAULT '' NOT NULL,
+	field_default_value varchar(255) DEFAULT '' NOT NULL,
+	field_validation varchar(20) DEFAULT '' NOT NULL,
+	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
+	field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0),
+	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
+	field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0),
+	field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
+	field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
+	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
+	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
+	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
+	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
+	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);
+
+/*
+	Table: 'phpbb_profile_fields_data'
+*/
+CREATE TABLE phpbb_profile_fields_data (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	PRIMARY KEY (user_id)
+);
+
+
+/*
+	Table: 'phpbb_profile_fields_lang'
+*/
+CREATE TABLE phpbb_profile_fields_lang (
+	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
+	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
+	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
+	field_type INT2 DEFAULT '0' NOT NULL,
+	lang_value varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (field_id, lang_id, option_id)
+);
+
+
+/*
+	Table: 'phpbb_profile_lang'
+*/
+CREATE TABLE phpbb_profile_lang (
+	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
+	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
+	lang_name varchar(255) DEFAULT '' NOT NULL,
+	lang_explain varchar(4000) DEFAULT '' NOT NULL,
+	lang_default_value varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (field_id, lang_id)
+);
+
+
+/*
+	Table: 'phpbb_ranks'
+*/
+CREATE SEQUENCE phpbb_ranks_seq;
+
+CREATE TABLE phpbb_ranks (
+	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
+	rank_title varchar(255) DEFAULT '' NOT NULL,
+	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
+	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
+	rank_image varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (rank_id)
+);
+
+
+/*
+	Table: 'phpbb_reports'
+*/
+CREATE SEQUENCE phpbb_reports_seq;
+
+CREATE TABLE phpbb_reports (
+	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
+	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
+	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
+	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
+	report_text TEXT DEFAULT '' NOT NULL,
+	reported_post_text TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (report_id)
+);
+
+CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
+CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
+
+/*
+	Table: 'phpbb_reports_reasons'
+*/
+CREATE SEQUENCE phpbb_reports_reasons_seq;
+
+CREATE TABLE phpbb_reports_reasons (
+	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
+	reason_title varchar(255) DEFAULT '' NOT NULL,
+	reason_description TEXT DEFAULT '' NOT NULL,
+	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
+	PRIMARY KEY (reason_id)
+);
+
+
+/*
+	Table: 'phpbb_search_results'
+*/
+CREATE TABLE phpbb_search_results (
+	search_key varchar(32) DEFAULT '' NOT NULL,
+	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
+	search_keywords TEXT DEFAULT '' NOT NULL,
+	search_authors TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (search_key)
+);
+
+
+/*
+	Table: 'phpbb_search_wordlist'
+*/
+CREATE SEQUENCE phpbb_search_wordlist_seq;
+
+CREATE TABLE phpbb_search_wordlist (
+	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
+	word_text varchar(255) DEFAULT '' NOT NULL,
+	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
+	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
+	PRIMARY KEY (word_id)
+);
+
+CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
+CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
+
+/*
+	Table: 'phpbb_search_wordmatch'
+*/
+CREATE TABLE phpbb_search_wordmatch (
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
+	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
+);
+
+CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (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 '' NOT NULL,
+	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
+	session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0),
+	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
+	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
+	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
+	session_ip varchar(40) DEFAULT '' NOT NULL,
+	session_browser varchar(150) DEFAULT '' NOT NULL,
+	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
+	session_page varchar(255) DEFAULT '' NOT NULL,
+	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
+	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
+	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
+	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);
+CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id);
+
+/*
+	Table: 'phpbb_sessions_keys'
+*/
+CREATE TABLE phpbb_sessions_keys (
+	key_id char(32) DEFAULT '' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	last_ip varchar(40) DEFAULT '' NOT NULL,
+	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
+	PRIMARY KEY (key_id, user_id)
+);
+
+CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
+
+/*
+	Table: 'phpbb_sitelist'
+*/
+CREATE SEQUENCE phpbb_sitelist_seq;
+
+CREATE TABLE phpbb_sitelist (
+	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
+	site_ip varchar(40) DEFAULT '' NOT NULL,
+	site_hostname varchar(255) DEFAULT '' NOT NULL,
+	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
+	PRIMARY KEY (site_id)
+);
+
+
+/*
+	Table: 'phpbb_smilies'
+*/
+CREATE SEQUENCE phpbb_smilies_seq;
+
+CREATE TABLE phpbb_smilies (
+	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
+	code varchar(50) DEFAULT '' NOT NULL,
+	emotion varchar(50) DEFAULT '' NOT NULL,
+	smiley_url varchar(50) DEFAULT '' NOT NULL,
+	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
+	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
+	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
+	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
+	PRIMARY KEY (smiley_id)
+);
+
+CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
+
+/*
+	Table: 'phpbb_styles'
+*/
+CREATE SEQUENCE phpbb_styles_seq;
+
+CREATE TABLE phpbb_styles (
+	style_id INT4 DEFAULT nextval('phpbb_styles_seq'),
+	style_name varchar(255) DEFAULT '' NOT NULL,
+	style_copyright varchar(255) DEFAULT '' NOT NULL,
+	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
+	style_path varchar(100) DEFAULT '' NOT NULL,
+	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
+	style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0),
+	style_parent_tree varchar(8000) DEFAULT '' NOT NULL,
+	PRIMARY KEY (style_id)
+);
+
+CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
+
+/*
+	Table: 'phpbb_topics'
+*/
+CREATE SEQUENCE phpbb_topics_seq;
+
+CREATE TABLE phpbb_topics (
+	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
+	topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
+	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
+	topic_title varchar(255) DEFAULT '' NOT NULL,
+	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
+	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
+	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
+	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
+	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
+	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
+	topic_status INT2 DEFAULT '0' NOT NULL,
+	topic_type INT2 DEFAULT '0' NOT NULL,
+	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
+	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
+	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
+	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
+	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
+	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	topic_last_post_subject varchar(255) DEFAULT '' NOT NULL,
+	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
+	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
+	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
+	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
+	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
+	poll_title varchar(255) DEFAULT '' NOT NULL,
+	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
+	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
+	poll_max_options INT2 DEFAULT '1' NOT NULL,
+	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
+	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
+	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);
+
+/*
+	Table: 'phpbb_topics_track'
+*/
+CREATE TABLE phpbb_topics_track (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
+	PRIMARY KEY (user_id, topic_id)
+);
+
+CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (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 INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
+	PRIMARY KEY (user_id, topic_id)
+);
+
+
+/*
+	Table: 'phpbb_topics_watch'
+*/
+CREATE TABLE phpbb_topics_watch (
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
+);
+
+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 INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
+	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
+);
+
+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 SEQUENCE phpbb_users_seq;
+
+CREATE TABLE phpbb_users (
+	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
+	user_type INT2 DEFAULT '0' NOT NULL,
+	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
+	user_permissions TEXT DEFAULT '' NOT NULL,
+	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
+	user_ip varchar(40) DEFAULT '' NOT NULL,
+	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
+	username varchar_ci DEFAULT '' NOT NULL,
+	username_clean varchar_ci DEFAULT '' NOT NULL,
+	user_password varchar(40) DEFAULT '' NOT NULL,
+	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
+	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
+	user_email varchar(100) DEFAULT '' NOT NULL,
+	user_email_hash INT8 DEFAULT '0' NOT NULL,
+	user_birthday varchar(10) DEFAULT '' NOT NULL,
+	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
+	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
+	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
+	user_lastpage varchar(200) DEFAULT '' NOT NULL,
+	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
+	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
+	user_warnings INT2 DEFAULT '0' NOT NULL,
+	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
+	user_login_attempts INT2 DEFAULT '0' NOT NULL,
+	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
+	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
+	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
+	user_lang varchar(30) DEFAULT '' NOT NULL,
+	user_timezone varchar(100) DEFAULT 'UTC' NOT NULL,
+	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
+	user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
+	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
+	user_colour varchar(6) DEFAULT '' NOT NULL,
+	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
+	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
+	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
+	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
+	user_full_folder INT4 DEFAULT '-3' NOT NULL,
+	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
+	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
+	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
+	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
+	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
+	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
+	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
+	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
+	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
+	user_notify_type INT2 DEFAULT '0' NOT NULL,
+	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
+	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
+	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
+	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
+	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
+	user_avatar varchar(255) DEFAULT '' NOT NULL,
+	user_avatar_type INT2 DEFAULT '0' NOT NULL,
+	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
+	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
+	user_sig TEXT DEFAULT '' NOT NULL,
+	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	user_from varchar(100) DEFAULT '' NOT NULL,
+	user_icq varchar(15) DEFAULT '' NOT NULL,
+	user_aim varchar(255) DEFAULT '' NOT NULL,
+	user_yim varchar(255) DEFAULT '' NOT NULL,
+	user_msnm varchar(255) DEFAULT '' NOT NULL,
+	user_jabber varchar(255) DEFAULT '' NOT NULL,
+	user_website varchar(200) DEFAULT '' NOT NULL,
+	user_occ varchar(4000) DEFAULT '' NOT NULL,
+	user_interests varchar(4000) DEFAULT '' NOT NULL,
+	user_actkey varchar(32) DEFAULT '' NOT NULL,
+	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
+	user_form_salt varchar(32) DEFAULT '' NOT NULL,
+	user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0),
+	user_reminded INT2 DEFAULT '0' NOT NULL,
+	user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0),
+	PRIMARY KEY (user_id)
+);
+
+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 UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
+
+/*
+	Table: 'phpbb_warnings'
+*/
+CREATE SEQUENCE phpbb_warnings_seq;
+
+CREATE TABLE phpbb_warnings (
+	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
+	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
+	PRIMARY KEY (warning_id)
+);
+
+
+/*
+	Table: 'phpbb_words'
+*/
+CREATE SEQUENCE phpbb_words_seq;
+
+CREATE TABLE phpbb_words (
+	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
+	word varchar(255) DEFAULT '' NOT NULL,
+	replacement varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (word_id)
+);
+
+
+/*
+	Table: 'phpbb_zebra'
+*/
+CREATE TABLE phpbb_zebra (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
+	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
+	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
+	PRIMARY KEY (user_id, zebra_id)
+);
-- 
cgit v1.2.1


From 9abfba51913a7c03cf72280ca45f27bab8b5bac9 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Tue, 28 Aug 2012 22:05:35 +0200
Subject: [feature/soft-delete] Fix the schema files to the correct line ends
 again

PHPBB3-9657
---
 phpBB/install/schemas/postgres_schema.sql | 2476 +++++++++++++++--------------
 1 file changed, 1240 insertions(+), 1236 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index e1678c9cc5..44440898e2 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1,1236 +1,1240 @@
-/*
- * DO NOT EDIT THIS FILE, IT IS GENERATED
- *
- * To change the contents of this file, edit
- * phpBB/develop/create_schema_files.php and
- * run it.
- */
-
-BEGIN;
-
-/*
-	Domain definition
-*/
-CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
-
-/*
-	Operation Functions
-*/
-CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
-
-/*
-	Operators
-*/
-CREATE OPERATOR <(
-  PROCEDURE = _varchar_ci_less_than,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = >,
-  NEGATOR = >=,
-  RESTRICT = scalarltsel,
-  JOIN = scalarltjoinsel);
-
-CREATE OPERATOR <=(
-  PROCEDURE = _varchar_ci_less_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = >=,
-  NEGATOR = >,
-  RESTRICT = scalarltsel,
-  JOIN = scalarltjoinsel);
-
-CREATE OPERATOR >(
-  PROCEDURE = _varchar_ci_greater_than,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <,
-  NEGATOR = <=,
-  RESTRICT = scalargtsel,
-  JOIN = scalargtjoinsel);
-
-CREATE OPERATOR >=(
-  PROCEDURE = _varchar_ci_greater_equals,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <=,
-  NEGATOR = <,
-  RESTRICT = scalargtsel,
-  JOIN = scalargtjoinsel);
-
-CREATE OPERATOR <>(
-  PROCEDURE = _varchar_ci_not_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = <>,
-  NEGATOR = =,
-  RESTRICT = neqsel,
-  JOIN = neqjoinsel);
-
-CREATE OPERATOR =(
-  PROCEDURE = _varchar_ci_equal,
-  LEFTARG = varchar_ci,
-  RIGHTARG = varchar_ci,
-  COMMUTATOR = =,
-  NEGATOR = <>,
-  RESTRICT = eqsel,
-  JOIN = eqjoinsel,
-  HASHES,
-  MERGES,
-  SORT1= <);
-
-/*
-	Table: 'phpbb_attachments'
-*/
-CREATE SEQUENCE phpbb_attachments_seq;
-
-CREATE TABLE phpbb_attachments (
-	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
-	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
-	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
-	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
-	physical_filename varchar(255) DEFAULT '' NOT NULL,
-	real_filename varchar(255) DEFAULT '' NOT NULL,
-	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
-	attach_comment varchar(4000) DEFAULT '' NOT NULL,
-	extension varchar(100) DEFAULT '' NOT NULL,
-	mimetype varchar(100) DEFAULT '' NOT NULL,
-	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
-	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
-	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
-	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);
-
-/*
-	Table: 'phpbb_acl_groups'
-*/
-CREATE TABLE phpbb_acl_groups (
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
-	auth_setting INT2 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 SEQUENCE phpbb_acl_options_seq;
-
-CREATE TABLE phpbb_acl_options (
-	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
-	auth_option varchar(50) DEFAULT '' NOT NULL,
-	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
-	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
-	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
-	PRIMARY KEY (auth_option_id)
-);
-
-CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
-
-/*
-	Table: 'phpbb_acl_roles'
-*/
-CREATE SEQUENCE phpbb_acl_roles_seq;
-
-CREATE TABLE phpbb_acl_roles (
-	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
-	role_name varchar(255) DEFAULT '' NOT NULL,
-	role_description varchar(4000) DEFAULT '' NOT NULL,
-	role_type varchar(10) DEFAULT '' NOT NULL,
-	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
-	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);
-
-/*
-	Table: 'phpbb_acl_roles_data'
-*/
-CREATE TABLE phpbb_acl_roles_data (
-	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_setting INT2 DEFAULT '0' NOT NULL,
-	PRIMARY KEY (role_id, auth_option_id)
-);
-
-CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
-
-/*
-	Table: 'phpbb_acl_users'
-*/
-CREATE TABLE phpbb_acl_users (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
-	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
-	auth_setting INT2 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 SEQUENCE phpbb_banlist_seq;
-
-CREATE TABLE phpbb_banlist (
-	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
-	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
-	ban_ip varchar(40) DEFAULT '' NOT NULL,
-	ban_email varchar(100) DEFAULT '' NOT NULL,
-	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
-	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
-	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
-	ban_reason varchar(255) DEFAULT '' NOT NULL,
-	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
-	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);
-
-/*
-	Table: 'phpbb_bbcodes'
-*/
-CREATE TABLE phpbb_bbcodes (
-	bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0),
-	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
-	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
-	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
-	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
-	bbcode_tpl TEXT DEFAULT '' NOT NULL,
-	first_pass_match TEXT DEFAULT '' NOT NULL,
-	first_pass_replace TEXT DEFAULT '' NOT NULL,
-	second_pass_match TEXT DEFAULT '' NOT NULL,
-	second_pass_replace TEXT DEFAULT '' NOT NULL,
-	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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	PRIMARY KEY (topic_id, user_id)
-);
-
-
-/*
-	Table: 'phpbb_bots'
-*/
-CREATE SEQUENCE phpbb_bots_seq;
-
-CREATE TABLE phpbb_bots (
-	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
-	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
-	bot_name varchar(255) DEFAULT '' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	bot_agent varchar(255) DEFAULT '' NOT NULL,
-	bot_ip varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (bot_id)
-);
-
-CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
-
-/*
-	Table: 'phpbb_config'
-*/
-CREATE TABLE phpbb_config (
-	config_name varchar(255) DEFAULT '' NOT NULL,
-	config_value varchar(255) DEFAULT '' NOT NULL,
-	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
-	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 '' NOT NULL,
-	session_id char(32) DEFAULT '' NOT NULL,
-	confirm_type INT2 DEFAULT '0' NOT NULL,
-	code varchar(8) DEFAULT '' NOT NULL,
-	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
-	attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0),
-	PRIMARY KEY (session_id, confirm_id)
-);
-
-CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
-
-/*
-	Table: 'phpbb_disallow'
-*/
-CREATE SEQUENCE phpbb_disallow_seq;
-
-CREATE TABLE phpbb_disallow (
-	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
-	disallow_username varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (disallow_id)
-);
-
-
-/*
-	Table: 'phpbb_drafts'
-*/
-CREATE SEQUENCE phpbb_drafts_seq;
-
-CREATE TABLE phpbb_drafts (
-	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
-	draft_subject varchar(255) DEFAULT '' NOT NULL,
-	draft_message TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (draft_id)
-);
-
-CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
-
-/*
-	Table: 'phpbb_ext'
-*/
-CREATE TABLE phpbb_ext (
-	ext_name varchar(255) DEFAULT '' NOT NULL,
-	ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0),
-	ext_state varchar(8000) DEFAULT '' NOT NULL
-);
-
-CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
-
-/*
-	Table: 'phpbb_extensions'
-*/
-CREATE SEQUENCE phpbb_extensions_seq;
-
-CREATE TABLE phpbb_extensions (
-	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	extension varchar(100) DEFAULT '' NOT NULL,
-	PRIMARY KEY (extension_id)
-);
-
-
-/*
-	Table: 'phpbb_extension_groups'
-*/
-CREATE SEQUENCE phpbb_extension_groups_seq;
-
-CREATE TABLE phpbb_extension_groups (
-	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
-	group_name varchar(255) DEFAULT '' NOT NULL,
-	cat_id INT2 DEFAULT '0' NOT NULL,
-	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
-	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
-	upload_icon varchar(255) DEFAULT '' NOT NULL,
-	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
-	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
-	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
-	PRIMARY KEY (group_id)
-);
-
-
-/*
-	Table: 'phpbb_forums'
-*/
-CREATE SEQUENCE phpbb_forums_seq;
-
-CREATE TABLE phpbb_forums (
-	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
-	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
-	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
-	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
-	forum_parents TEXT DEFAULT '' NOT NULL,
-	forum_name varchar(255) DEFAULT '' NOT NULL,
-	forum_desc varchar(4000) DEFAULT '' NOT NULL,
-	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
-	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
-	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
-	forum_link varchar(255) DEFAULT '' NOT NULL,
-	forum_password varchar(40) DEFAULT '' NOT NULL,
-	forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
-	forum_image varchar(255) DEFAULT '' NOT NULL,
-	forum_rules varchar(4000) DEFAULT '' NOT NULL,
-	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
-	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
-	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
-	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
-	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
-	forum_type INT2 DEFAULT '0' NOT NULL,
-	forum_status INT2 DEFAULT '0' NOT NULL,
-	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
-	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
-	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
-	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
-	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
-	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
-	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
-	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
-	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	forum_flags INT2 DEFAULT '32' NOT NULL,
-	forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
-	display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
-	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
-	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
-	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
-	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
-	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
-	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
-	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
-	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
-	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);
-
-/*
-	Table: 'phpbb_forums_access'
-*/
-CREATE TABLE phpbb_forums_access (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	session_id char(32) DEFAULT '' NOT NULL,
-	PRIMARY KEY (forum_id, user_id, session_id)
-);
-
-
-/*
-	Table: 'phpbb_forums_track'
-*/
-CREATE TABLE phpbb_forums_track (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
-	PRIMARY KEY (user_id, forum_id)
-);
-
-
-/*
-	Table: 'phpbb_forums_watch'
-*/
-CREATE TABLE phpbb_forums_watch (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
-);
-
-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 SEQUENCE phpbb_groups_seq;
-
-CREATE TABLE phpbb_groups (
-	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
-	group_type INT2 DEFAULT '1' NOT NULL,
-	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
-	group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0),
-	group_name varchar_ci DEFAULT '' NOT NULL,
-	group_desc varchar(4000) DEFAULT '' NOT NULL,
-	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
-	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
-	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
-	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
-	group_avatar varchar(255) DEFAULT '' NOT NULL,
-	group_avatar_type INT2 DEFAULT '0' NOT NULL,
-	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
-	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
-	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
-	group_colour varchar(6) DEFAULT '' NOT NULL,
-	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
-	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
-	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
-	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
-	group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
-	group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
-	PRIMARY KEY (group_id)
-);
-
-CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
-
-/*
-	Table: 'phpbb_icons'
-*/
-CREATE SEQUENCE phpbb_icons_seq;
-
-CREATE TABLE phpbb_icons (
-	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
-	icons_url varchar(255) DEFAULT '' NOT NULL,
-	icons_width INT2 DEFAULT '0' NOT NULL,
-	icons_height INT2 DEFAULT '0' NOT NULL,
-	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
-	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
-	PRIMARY KEY (icons_id)
-);
-
-CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
-
-/*
-	Table: 'phpbb_lang'
-*/
-CREATE SEQUENCE phpbb_lang_seq;
-
-CREATE TABLE phpbb_lang (
-	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
-	lang_iso varchar(30) DEFAULT '' NOT NULL,
-	lang_dir varchar(30) DEFAULT '' NOT NULL,
-	lang_english_name varchar(100) DEFAULT '' NOT NULL,
-	lang_local_name varchar(255) DEFAULT '' NOT NULL,
-	lang_author varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (lang_id)
-);
-
-CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
-
-/*
-	Table: 'phpbb_log'
-*/
-CREATE SEQUENCE phpbb_log_seq;
-
-CREATE TABLE phpbb_log (
-	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
-	log_type INT2 DEFAULT '0' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
-	log_ip varchar(40) DEFAULT '' NOT NULL,
-	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
-	log_operation varchar(4000) DEFAULT '' NOT NULL,
-	log_data TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (log_id)
-);
-
-CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
-CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time);
-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);
-
-/*
-	Table: 'phpbb_login_attempts'
-*/
-CREATE TABLE phpbb_login_attempts (
-	attempt_ip varchar(40) DEFAULT '' NOT NULL,
-	attempt_browser varchar(150) DEFAULT '' NOT NULL,
-	attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
-	attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	username varchar(255) DEFAULT '0' NOT NULL,
-	username_clean varchar_ci DEFAULT '0' NOT NULL
-);
-
-CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
-CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time);
-CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
-CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
-
-/*
-	Table: 'phpbb_moderator_cache'
-*/
-CREATE TABLE phpbb_moderator_cache (
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	username varchar(255) DEFAULT '' NOT NULL,
-	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	group_name varchar(255) DEFAULT '' NOT NULL,
-	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
-);
-
-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 SEQUENCE phpbb_modules_seq;
-
-CREATE TABLE phpbb_modules (
-	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
-	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
-	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
-	module_basename varchar(255) DEFAULT '' NOT NULL,
-	module_class varchar(10) DEFAULT '' NOT NULL,
-	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
-	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
-	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
-	module_langname varchar(255) DEFAULT '' NOT NULL,
-	module_mode varchar(255) DEFAULT '' NOT NULL,
-	module_auth varchar(255) DEFAULT '' NOT NULL,
-	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);
-
-/*
-	Table: 'phpbb_poll_options'
-*/
-CREATE TABLE phpbb_poll_options (
-	poll_option_id INT2 DEFAULT '0' NOT NULL,
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
-	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
-);
-
-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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	poll_option_id INT2 DEFAULT '0' NOT NULL,
-	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
-	vote_user_ip varchar(40) DEFAULT '' NOT NULL
-);
-
-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 SEQUENCE phpbb_posts_seq;
-
-CREATE TABLE phpbb_posts (
-	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	poster_ip varchar(40) DEFAULT '' NOT NULL,
-	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
-	post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
-	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
-	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
-	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
-	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
-	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
-	post_username varchar(255) DEFAULT '' NOT NULL,
-	post_subject varchar(255) DEFAULT '' NOT NULL,
-	post_text TEXT DEFAULT '' NOT NULL,
-	post_checksum varchar(32) DEFAULT '' NOT NULL,
-	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
-	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
-	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
-	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
-	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
-	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
-	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
-	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_post_username ON phpbb_posts (post_username);
-CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
-
-/*
-	Table: 'phpbb_privmsgs'
-*/
-CREATE SEQUENCE phpbb_privmsgs_seq;
-
-CREATE TABLE phpbb_privmsgs (
-	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
-	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
-	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	author_ip varchar(40) DEFAULT '' NOT NULL,
-	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
-	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
-	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
-	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
-	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
-	message_subject varchar(255) DEFAULT '' NOT NULL,
-	message_text TEXT DEFAULT '' NOT NULL,
-	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
-	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
-	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
-	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
-	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
-	to_address varchar(4000) DEFAULT '' NOT NULL,
-	bcc_address varchar(4000) DEFAULT '' NOT NULL,
-	message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0),
-	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);
-
-/*
-	Table: 'phpbb_privmsgs_folder'
-*/
-CREATE SEQUENCE phpbb_privmsgs_folder_seq;
-
-CREATE TABLE phpbb_privmsgs_folder (
-	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	folder_name varchar(255) DEFAULT '' NOT NULL,
-	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
-	PRIMARY KEY (folder_id)
-);
-
-CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
-
-/*
-	Table: 'phpbb_privmsgs_rules'
-*/
-CREATE SEQUENCE phpbb_privmsgs_rules_seq;
-
-CREATE TABLE phpbb_privmsgs_rules (
-	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
-	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
-	rule_string varchar(255) DEFAULT '' NOT NULL,
-	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
-	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
-	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
-	rule_folder_id INT4 DEFAULT '0' NOT NULL,
-	PRIMARY KEY (rule_id)
-);
-
-CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
-
-/*
-	Table: 'phpbb_privmsgs_to'
-*/
-CREATE TABLE phpbb_privmsgs_to (
-	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
-	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
-	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
-	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
-	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
-	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
-	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
-	folder_id INT4 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 SEQUENCE phpbb_profile_fields_seq;
-
-CREATE TABLE phpbb_profile_fields (
-	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
-	field_name varchar(255) DEFAULT '' NOT NULL,
-	field_type INT2 DEFAULT '0' NOT NULL,
-	field_ident varchar(20) DEFAULT '' NOT NULL,
-	field_length varchar(20) DEFAULT '' NOT NULL,
-	field_minlen varchar(255) DEFAULT '' NOT NULL,
-	field_maxlen varchar(255) DEFAULT '' NOT NULL,
-	field_novalue varchar(255) DEFAULT '' NOT NULL,
-	field_default_value varchar(255) DEFAULT '' NOT NULL,
-	field_validation varchar(20) DEFAULT '' NOT NULL,
-	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
-	field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0),
-	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
-	field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0),
-	field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
-	field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
-	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
-	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
-	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
-	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
-	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);
-
-/*
-	Table: 'phpbb_profile_fields_data'
-*/
-CREATE TABLE phpbb_profile_fields_data (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	PRIMARY KEY (user_id)
-);
-
-
-/*
-	Table: 'phpbb_profile_fields_lang'
-*/
-CREATE TABLE phpbb_profile_fields_lang (
-	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
-	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
-	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
-	field_type INT2 DEFAULT '0' NOT NULL,
-	lang_value varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (field_id, lang_id, option_id)
-);
-
-
-/*
-	Table: 'phpbb_profile_lang'
-*/
-CREATE TABLE phpbb_profile_lang (
-	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
-	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
-	lang_name varchar(255) DEFAULT '' NOT NULL,
-	lang_explain varchar(4000) DEFAULT '' NOT NULL,
-	lang_default_value varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (field_id, lang_id)
-);
-
-
-/*
-	Table: 'phpbb_ranks'
-*/
-CREATE SEQUENCE phpbb_ranks_seq;
-
-CREATE TABLE phpbb_ranks (
-	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
-	rank_title varchar(255) DEFAULT '' NOT NULL,
-	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
-	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
-	rank_image varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (rank_id)
-);
-
-
-/*
-	Table: 'phpbb_reports'
-*/
-CREATE SEQUENCE phpbb_reports_seq;
-
-CREATE TABLE phpbb_reports (
-	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
-	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
-	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
-	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
-	report_text TEXT DEFAULT '' NOT NULL,
-	reported_post_text TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (report_id)
-);
-
-CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
-CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
-
-/*
-	Table: 'phpbb_reports_reasons'
-*/
-CREATE SEQUENCE phpbb_reports_reasons_seq;
-
-CREATE TABLE phpbb_reports_reasons (
-	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
-	reason_title varchar(255) DEFAULT '' NOT NULL,
-	reason_description TEXT DEFAULT '' NOT NULL,
-	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
-	PRIMARY KEY (reason_id)
-);
-
-
-/*
-	Table: 'phpbb_search_results'
-*/
-CREATE TABLE phpbb_search_results (
-	search_key varchar(32) DEFAULT '' NOT NULL,
-	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
-	search_keywords TEXT DEFAULT '' NOT NULL,
-	search_authors TEXT DEFAULT '' NOT NULL,
-	PRIMARY KEY (search_key)
-);
-
-
-/*
-	Table: 'phpbb_search_wordlist'
-*/
-CREATE SEQUENCE phpbb_search_wordlist_seq;
-
-CREATE TABLE phpbb_search_wordlist (
-	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
-	word_text varchar(255) DEFAULT '' NOT NULL,
-	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
-	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
-	PRIMARY KEY (word_id)
-);
-
-CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
-CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
-
-/*
-	Table: 'phpbb_search_wordmatch'
-*/
-CREATE TABLE phpbb_search_wordmatch (
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
-	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
-);
-
-CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (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 '' NOT NULL,
-	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
-	session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0),
-	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
-	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
-	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
-	session_ip varchar(40) DEFAULT '' NOT NULL,
-	session_browser varchar(150) DEFAULT '' NOT NULL,
-	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
-	session_page varchar(255) DEFAULT '' NOT NULL,
-	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
-	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
-	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
-	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);
-CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id);
-
-/*
-	Table: 'phpbb_sessions_keys'
-*/
-CREATE TABLE phpbb_sessions_keys (
-	key_id char(32) DEFAULT '' NOT NULL,
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	last_ip varchar(40) DEFAULT '' NOT NULL,
-	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
-	PRIMARY KEY (key_id, user_id)
-);
-
-CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
-
-/*
-	Table: 'phpbb_sitelist'
-*/
-CREATE SEQUENCE phpbb_sitelist_seq;
-
-CREATE TABLE phpbb_sitelist (
-	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
-	site_ip varchar(40) DEFAULT '' NOT NULL,
-	site_hostname varchar(255) DEFAULT '' NOT NULL,
-	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
-	PRIMARY KEY (site_id)
-);
-
-
-/*
-	Table: 'phpbb_smilies'
-*/
-CREATE SEQUENCE phpbb_smilies_seq;
-
-CREATE TABLE phpbb_smilies (
-	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
-	code varchar(50) DEFAULT '' NOT NULL,
-	emotion varchar(50) DEFAULT '' NOT NULL,
-	smiley_url varchar(50) DEFAULT '' NOT NULL,
-	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
-	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
-	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
-	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
-	PRIMARY KEY (smiley_id)
-);
-
-CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
-
-/*
-	Table: 'phpbb_styles'
-*/
-CREATE SEQUENCE phpbb_styles_seq;
-
-CREATE TABLE phpbb_styles (
-	style_id INT4 DEFAULT nextval('phpbb_styles_seq'),
-	style_name varchar(255) DEFAULT '' NOT NULL,
-	style_copyright varchar(255) DEFAULT '' NOT NULL,
-	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
-	style_path varchar(100) DEFAULT '' NOT NULL,
-	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
-	style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0),
-	style_parent_tree varchar(8000) DEFAULT '' NOT NULL,
-	PRIMARY KEY (style_id)
-);
-
-CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
-
-/*
-	Table: 'phpbb_topics'
-*/
-CREATE SEQUENCE phpbb_topics_seq;
-
-CREATE TABLE phpbb_topics (
-	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
-	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
-	topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
-	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
-	topic_title varchar(255) DEFAULT '' NOT NULL,
-	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
-	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
-	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
-	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
-	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
-	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
-	topic_status INT2 DEFAULT '0' NOT NULL,
-	topic_type INT2 DEFAULT '0' NOT NULL,
-	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
-	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
-	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
-	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
-	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
-	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
-	topic_last_post_subject varchar(255) DEFAULT '' NOT NULL,
-	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
-	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
-	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
-	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
-	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
-	poll_title varchar(255) DEFAULT '' NOT NULL,
-	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
-	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
-	poll_max_options INT2 DEFAULT '1' NOT NULL,
-	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
-	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
-	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);
-
-/*
-	Table: 'phpbb_topics_track'
-*/
-CREATE TABLE phpbb_topics_track (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
-	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
-	PRIMARY KEY (user_id, topic_id)
-);
-
-CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (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 INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
-	PRIMARY KEY (user_id, topic_id)
-);
-
-
-/*
-	Table: 'phpbb_topics_watch'
-*/
-CREATE TABLE phpbb_topics_watch (
-	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
-);
-
-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 INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
-	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
-);
-
-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 SEQUENCE phpbb_users_seq;
-
-CREATE TABLE phpbb_users (
-	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
-	user_type INT2 DEFAULT '0' NOT NULL,
-	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
-	user_permissions TEXT DEFAULT '' NOT NULL,
-	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
-	user_ip varchar(40) DEFAULT '' NOT NULL,
-	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
-	username varchar_ci DEFAULT '' NOT NULL,
-	username_clean varchar_ci DEFAULT '' NOT NULL,
-	user_password varchar(40) DEFAULT '' NOT NULL,
-	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
-	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
-	user_email varchar(100) DEFAULT '' NOT NULL,
-	user_email_hash INT8 DEFAULT '0' NOT NULL,
-	user_birthday varchar(10) DEFAULT '' NOT NULL,
-	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
-	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
-	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
-	user_lastpage varchar(200) DEFAULT '' NOT NULL,
-	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
-	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
-	user_warnings INT2 DEFAULT '0' NOT NULL,
-	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
-	user_login_attempts INT2 DEFAULT '0' NOT NULL,
-	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
-	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
-	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
-	user_lang varchar(30) DEFAULT '' NOT NULL,
-	user_timezone varchar(100) DEFAULT 'UTC' NOT NULL,
-	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
-	user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
-	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
-	user_colour varchar(6) DEFAULT '' NOT NULL,
-	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
-	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
-	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
-	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
-	user_full_folder INT4 DEFAULT '-3' NOT NULL,
-	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
-	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
-	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
-	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
-	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
-	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
-	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
-	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
-	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
-	user_notify_type INT2 DEFAULT '0' NOT NULL,
-	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
-	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
-	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
-	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
-	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
-	user_avatar varchar(255) DEFAULT '' NOT NULL,
-	user_avatar_type INT2 DEFAULT '0' NOT NULL,
-	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
-	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
-	user_sig TEXT DEFAULT '' NOT NULL,
-	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
-	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
-	user_from varchar(100) DEFAULT '' NOT NULL,
-	user_icq varchar(15) DEFAULT '' NOT NULL,
-	user_aim varchar(255) DEFAULT '' NOT NULL,
-	user_yim varchar(255) DEFAULT '' NOT NULL,
-	user_msnm varchar(255) DEFAULT '' NOT NULL,
-	user_jabber varchar(255) DEFAULT '' NOT NULL,
-	user_website varchar(200) DEFAULT '' NOT NULL,
-	user_occ varchar(4000) DEFAULT '' NOT NULL,
-	user_interests varchar(4000) DEFAULT '' NOT NULL,
-	user_actkey varchar(32) DEFAULT '' NOT NULL,
-	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
-	user_form_salt varchar(32) DEFAULT '' NOT NULL,
-	user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0),
-	user_reminded INT2 DEFAULT '0' NOT NULL,
-	user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0),
-	PRIMARY KEY (user_id)
-);
-
-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 UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
-
-/*
-	Table: 'phpbb_warnings'
-*/
-CREATE SEQUENCE phpbb_warnings_seq;
-
-CREATE TABLE phpbb_warnings (
-	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
-	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
-	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
-	PRIMARY KEY (warning_id)
-);
-
-
-/*
-	Table: 'phpbb_words'
-*/
-CREATE SEQUENCE phpbb_words_seq;
-
-CREATE TABLE phpbb_words (
-	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
-	word varchar(255) DEFAULT '' NOT NULL,
-	replacement varchar(255) DEFAULT '' NOT NULL,
-	PRIMARY KEY (word_id)
-);
-
-
-/*
-	Table: 'phpbb_zebra'
-*/
-CREATE TABLE phpbb_zebra (
-	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
-	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
-	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
-	PRIMARY KEY (user_id, zebra_id)
-);
+/*
+ * DO NOT EDIT THIS FILE, IT IS GENERATED
+ *
+ * To change the contents of this file, edit
+ * phpBB/develop/create_schema_files.php and
+ * run it.
+ */
+
+BEGIN;
+
+/*
+	Domain definition
+*/
+CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
+
+/*
+	Operation Functions
+*/
+CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
+CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
+
+/*
+	Operators
+*/
+CREATE OPERATOR <(
+  PROCEDURE = _varchar_ci_less_than,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = >,
+  NEGATOR = >=,
+  RESTRICT = scalarltsel,
+  JOIN = scalarltjoinsel);
+
+CREATE OPERATOR <=(
+  PROCEDURE = _varchar_ci_less_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = >=,
+  NEGATOR = >,
+  RESTRICT = scalarltsel,
+  JOIN = scalarltjoinsel);
+
+CREATE OPERATOR >(
+  PROCEDURE = _varchar_ci_greater_than,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <,
+  NEGATOR = <=,
+  RESTRICT = scalargtsel,
+  JOIN = scalargtjoinsel);
+
+CREATE OPERATOR >=(
+  PROCEDURE = _varchar_ci_greater_equals,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <=,
+  NEGATOR = <,
+  RESTRICT = scalargtsel,
+  JOIN = scalargtjoinsel);
+
+CREATE OPERATOR <>(
+  PROCEDURE = _varchar_ci_not_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = <>,
+  NEGATOR = =,
+  RESTRICT = neqsel,
+  JOIN = neqjoinsel);
+
+CREATE OPERATOR =(
+  PROCEDURE = _varchar_ci_equal,
+  LEFTARG = varchar_ci,
+  RIGHTARG = varchar_ci,
+  COMMUTATOR = =,
+  NEGATOR = <>,
+  RESTRICT = eqsel,
+  JOIN = eqjoinsel,
+  HASHES,
+  MERGES,
+  SORT1= <);
+
+/*
+	Table: 'phpbb_attachments'
+*/
+CREATE SEQUENCE phpbb_attachments_seq;
+
+CREATE TABLE phpbb_attachments (
+	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
+	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
+	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
+	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
+	physical_filename varchar(255) DEFAULT '' NOT NULL,
+	real_filename varchar(255) DEFAULT '' NOT NULL,
+	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
+	attach_comment varchar(4000) DEFAULT '' NOT NULL,
+	extension varchar(100) DEFAULT '' NOT NULL,
+	mimetype varchar(100) DEFAULT '' NOT NULL,
+	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
+	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
+	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
+	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);
+
+/*
+	Table: 'phpbb_acl_groups'
+*/
+CREATE TABLE phpbb_acl_groups (
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
+	auth_setting INT2 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 SEQUENCE phpbb_acl_options_seq;
+
+CREATE TABLE phpbb_acl_options (
+	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
+	auth_option varchar(50) DEFAULT '' NOT NULL,
+	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
+	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
+	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
+	PRIMARY KEY (auth_option_id)
+);
+
+CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
+
+/*
+	Table: 'phpbb_acl_roles'
+*/
+CREATE SEQUENCE phpbb_acl_roles_seq;
+
+CREATE TABLE phpbb_acl_roles (
+	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
+	role_name varchar(255) DEFAULT '' NOT NULL,
+	role_description varchar(4000) DEFAULT '' NOT NULL,
+	role_type varchar(10) DEFAULT '' NOT NULL,
+	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
+	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);
+
+/*
+	Table: 'phpbb_acl_roles_data'
+*/
+CREATE TABLE phpbb_acl_roles_data (
+	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_setting INT2 DEFAULT '0' NOT NULL,
+	PRIMARY KEY (role_id, auth_option_id)
+);
+
+CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
+
+/*
+	Table: 'phpbb_acl_users'
+*/
+CREATE TABLE phpbb_acl_users (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
+	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
+	auth_setting INT2 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 SEQUENCE phpbb_banlist_seq;
+
+CREATE TABLE phpbb_banlist (
+	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
+	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
+	ban_ip varchar(40) DEFAULT '' NOT NULL,
+	ban_email varchar(100) DEFAULT '' NOT NULL,
+	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
+	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
+	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
+	ban_reason varchar(255) DEFAULT '' NOT NULL,
+	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
+	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);
+
+/*
+	Table: 'phpbb_bbcodes'
+*/
+CREATE TABLE phpbb_bbcodes (
+	bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0),
+	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
+	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
+	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
+	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
+	bbcode_tpl TEXT DEFAULT '' NOT NULL,
+	first_pass_match TEXT DEFAULT '' NOT NULL,
+	first_pass_replace TEXT DEFAULT '' NOT NULL,
+	second_pass_match TEXT DEFAULT '' NOT NULL,
+	second_pass_replace TEXT DEFAULT '' NOT NULL,
+	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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	PRIMARY KEY (topic_id, user_id)
+);
+
+
+/*
+	Table: 'phpbb_bots'
+*/
+CREATE SEQUENCE phpbb_bots_seq;
+
+CREATE TABLE phpbb_bots (
+	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
+	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
+	bot_name varchar(255) DEFAULT '' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	bot_agent varchar(255) DEFAULT '' NOT NULL,
+	bot_ip varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (bot_id)
+);
+
+CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
+
+/*
+	Table: 'phpbb_config'
+*/
+CREATE TABLE phpbb_config (
+	config_name varchar(255) DEFAULT '' NOT NULL,
+	config_value varchar(255) DEFAULT '' NOT NULL,
+	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
+	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 '' NOT NULL,
+	session_id char(32) DEFAULT '' NOT NULL,
+	confirm_type INT2 DEFAULT '0' NOT NULL,
+	code varchar(8) DEFAULT '' NOT NULL,
+	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
+	attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0),
+	PRIMARY KEY (session_id, confirm_id)
+);
+
+CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
+
+/*
+	Table: 'phpbb_disallow'
+*/
+CREATE SEQUENCE phpbb_disallow_seq;
+
+CREATE TABLE phpbb_disallow (
+	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
+	disallow_username varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (disallow_id)
+);
+
+
+/*
+	Table: 'phpbb_drafts'
+*/
+CREATE SEQUENCE phpbb_drafts_seq;
+
+CREATE TABLE phpbb_drafts (
+	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
+	draft_subject varchar(255) DEFAULT '' NOT NULL,
+	draft_message TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (draft_id)
+);
+
+CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
+
+/*
+	Table: 'phpbb_ext'
+*/
+CREATE TABLE phpbb_ext (
+	ext_name varchar(255) DEFAULT '' NOT NULL,
+	ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0),
+	ext_state varchar(8000) DEFAULT '' NOT NULL
+);
+
+CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
+
+/*
+	Table: 'phpbb_extensions'
+*/
+CREATE SEQUENCE phpbb_extensions_seq;
+
+CREATE TABLE phpbb_extensions (
+	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	extension varchar(100) DEFAULT '' NOT NULL,
+	PRIMARY KEY (extension_id)
+);
+
+
+/*
+	Table: 'phpbb_extension_groups'
+*/
+CREATE SEQUENCE phpbb_extension_groups_seq;
+
+CREATE TABLE phpbb_extension_groups (
+	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
+	group_name varchar(255) DEFAULT '' NOT NULL,
+	cat_id INT2 DEFAULT '0' NOT NULL,
+	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
+	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
+	upload_icon varchar(255) DEFAULT '' NOT NULL,
+	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
+	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
+	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
+	PRIMARY KEY (group_id)
+);
+
+
+/*
+	Table: 'phpbb_forums'
+*/
+CREATE SEQUENCE phpbb_forums_seq;
+
+CREATE TABLE phpbb_forums (
+	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
+	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
+	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
+	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
+	forum_parents TEXT DEFAULT '' NOT NULL,
+	forum_name varchar(255) DEFAULT '' NOT NULL,
+	forum_desc varchar(4000) DEFAULT '' NOT NULL,
+	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
+	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
+	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
+	forum_link varchar(255) DEFAULT '' NOT NULL,
+	forum_password varchar(40) DEFAULT '' NOT NULL,
+	forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
+	forum_image varchar(255) DEFAULT '' NOT NULL,
+	forum_rules varchar(4000) DEFAULT '' NOT NULL,
+	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
+	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
+	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
+	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
+	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
+	forum_type INT2 DEFAULT '0' NOT NULL,
+	forum_status INT2 DEFAULT '0' NOT NULL,
+	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
+	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
+	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
+	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
+	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
+	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
+	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
+	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
+	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	forum_flags INT2 DEFAULT '32' NOT NULL,
+	forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
+	display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
+	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
+	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
+	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
+	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
+	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
+	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
+	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
+	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
+	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);
+
+/*
+	Table: 'phpbb_forums_access'
+*/
+CREATE TABLE phpbb_forums_access (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	session_id char(32) DEFAULT '' NOT NULL,
+	PRIMARY KEY (forum_id, user_id, session_id)
+);
+
+
+/*
+	Table: 'phpbb_forums_track'
+*/
+CREATE TABLE phpbb_forums_track (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
+	PRIMARY KEY (user_id, forum_id)
+);
+
+
+/*
+	Table: 'phpbb_forums_watch'
+*/
+CREATE TABLE phpbb_forums_watch (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
+);
+
+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 SEQUENCE phpbb_groups_seq;
+
+CREATE TABLE phpbb_groups (
+	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
+	group_type INT2 DEFAULT '1' NOT NULL,
+	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
+	group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0),
+	group_name varchar_ci DEFAULT '' NOT NULL,
+	group_desc varchar(4000) DEFAULT '' NOT NULL,
+	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
+	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
+	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
+	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
+	group_avatar varchar(255) DEFAULT '' NOT NULL,
+	group_avatar_type INT2 DEFAULT '0' NOT NULL,
+	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
+	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
+	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
+	group_colour varchar(6) DEFAULT '' NOT NULL,
+	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
+	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
+	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
+	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
+	group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
+	group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
+	PRIMARY KEY (group_id)
+);
+
+CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
+
+/*
+	Table: 'phpbb_icons'
+*/
+CREATE SEQUENCE phpbb_icons_seq;
+
+CREATE TABLE phpbb_icons (
+	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
+	icons_url varchar(255) DEFAULT '' NOT NULL,
+	icons_width INT2 DEFAULT '0' NOT NULL,
+	icons_height INT2 DEFAULT '0' NOT NULL,
+	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
+	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
+	PRIMARY KEY (icons_id)
+);
+
+CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
+
+/*
+	Table: 'phpbb_lang'
+*/
+CREATE SEQUENCE phpbb_lang_seq;
+
+CREATE TABLE phpbb_lang (
+	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
+	lang_iso varchar(30) DEFAULT '' NOT NULL,
+	lang_dir varchar(30) DEFAULT '' NOT NULL,
+	lang_english_name varchar(100) DEFAULT '' NOT NULL,
+	lang_local_name varchar(255) DEFAULT '' NOT NULL,
+	lang_author varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (lang_id)
+);
+
+CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
+
+/*
+	Table: 'phpbb_log'
+*/
+CREATE SEQUENCE phpbb_log_seq;
+
+CREATE TABLE phpbb_log (
+	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
+	log_type INT2 DEFAULT '0' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
+	log_ip varchar(40) DEFAULT '' NOT NULL,
+	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
+	log_operation varchar(4000) DEFAULT '' NOT NULL,
+	log_data TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (log_id)
+);
+
+CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
+CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time);
+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);
+
+/*
+	Table: 'phpbb_login_attempts'
+*/
+CREATE TABLE phpbb_login_attempts (
+	attempt_ip varchar(40) DEFAULT '' NOT NULL,
+	attempt_browser varchar(150) DEFAULT '' NOT NULL,
+	attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
+	attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	username varchar(255) DEFAULT '0' NOT NULL,
+	username_clean varchar_ci DEFAULT '0' NOT NULL
+);
+
+CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
+CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time);
+CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
+CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
+
+/*
+	Table: 'phpbb_moderator_cache'
+*/
+CREATE TABLE phpbb_moderator_cache (
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	username varchar(255) DEFAULT '' NOT NULL,
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	group_name varchar(255) DEFAULT '' NOT NULL,
+	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
+);
+
+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 SEQUENCE phpbb_modules_seq;
+
+CREATE TABLE phpbb_modules (
+	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
+	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
+	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
+	module_basename varchar(255) DEFAULT '' NOT NULL,
+	module_class varchar(10) DEFAULT '' NOT NULL,
+	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
+	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
+	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
+	module_langname varchar(255) DEFAULT '' NOT NULL,
+	module_mode varchar(255) DEFAULT '' NOT NULL,
+	module_auth varchar(255) DEFAULT '' NOT NULL,
+	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);
+
+/*
+	Table: 'phpbb_poll_options'
+*/
+CREATE TABLE phpbb_poll_options (
+	poll_option_id INT2 DEFAULT '0' NOT NULL,
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
+	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
+);
+
+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 INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	poll_option_id INT2 DEFAULT '0' NOT NULL,
+	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
+	vote_user_ip varchar(40) DEFAULT '' NOT NULL
+);
+
+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 SEQUENCE phpbb_posts_seq;
+
+CREATE TABLE phpbb_posts (
+	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	poster_ip varchar(40) DEFAULT '' NOT NULL,
+	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
+	post_visibility INT2 DEFAULT '0' NOT NULL,
+	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
+	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
+	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
+	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
+	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
+	post_username varchar(255) DEFAULT '' NOT NULL,
+	post_subject varchar(255) DEFAULT '' NOT NULL,
+	post_text TEXT DEFAULT '' NOT NULL,
+	post_checksum varchar(32) DEFAULT '' NOT NULL,
+	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
+	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
+	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
+	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
+	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
+	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
+	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
+	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_visibility ON phpbb_posts (post_visibility);
+CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username);
+CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
+
+/*
+	Table: 'phpbb_privmsgs'
+*/
+CREATE SEQUENCE phpbb_privmsgs_seq;
+
+CREATE TABLE phpbb_privmsgs (
+	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
+	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
+	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	author_ip varchar(40) DEFAULT '' NOT NULL,
+	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
+	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
+	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
+	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
+	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
+	message_subject varchar(255) DEFAULT '' NOT NULL,
+	message_text TEXT DEFAULT '' NOT NULL,
+	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
+	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
+	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
+	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
+	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
+	to_address varchar(4000) DEFAULT '' NOT NULL,
+	bcc_address varchar(4000) DEFAULT '' NOT NULL,
+	message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0),
+	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);
+
+/*
+	Table: 'phpbb_privmsgs_folder'
+*/
+CREATE SEQUENCE phpbb_privmsgs_folder_seq;
+
+CREATE TABLE phpbb_privmsgs_folder (
+	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	folder_name varchar(255) DEFAULT '' NOT NULL,
+	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
+	PRIMARY KEY (folder_id)
+);
+
+CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
+
+/*
+	Table: 'phpbb_privmsgs_rules'
+*/
+CREATE SEQUENCE phpbb_privmsgs_rules_seq;
+
+CREATE TABLE phpbb_privmsgs_rules (
+	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
+	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
+	rule_string varchar(255) DEFAULT '' NOT NULL,
+	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
+	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
+	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
+	rule_folder_id INT4 DEFAULT '0' NOT NULL,
+	PRIMARY KEY (rule_id)
+);
+
+CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
+
+/*
+	Table: 'phpbb_privmsgs_to'
+*/
+CREATE TABLE phpbb_privmsgs_to (
+	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
+	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
+	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
+	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
+	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
+	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
+	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
+	folder_id INT4 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 SEQUENCE phpbb_profile_fields_seq;
+
+CREATE TABLE phpbb_profile_fields (
+	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
+	field_name varchar(255) DEFAULT '' NOT NULL,
+	field_type INT2 DEFAULT '0' NOT NULL,
+	field_ident varchar(20) DEFAULT '' NOT NULL,
+	field_length varchar(20) DEFAULT '' NOT NULL,
+	field_minlen varchar(255) DEFAULT '' NOT NULL,
+	field_maxlen varchar(255) DEFAULT '' NOT NULL,
+	field_novalue varchar(255) DEFAULT '' NOT NULL,
+	field_default_value varchar(255) DEFAULT '' NOT NULL,
+	field_validation varchar(20) DEFAULT '' NOT NULL,
+	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
+	field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0),
+	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
+	field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0),
+	field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0),
+	field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
+	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
+	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
+	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
+	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
+	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);
+
+/*
+	Table: 'phpbb_profile_fields_data'
+*/
+CREATE TABLE phpbb_profile_fields_data (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	PRIMARY KEY (user_id)
+);
+
+
+/*
+	Table: 'phpbb_profile_fields_lang'
+*/
+CREATE TABLE phpbb_profile_fields_lang (
+	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
+	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
+	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
+	field_type INT2 DEFAULT '0' NOT NULL,
+	lang_value varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (field_id, lang_id, option_id)
+);
+
+
+/*
+	Table: 'phpbb_profile_lang'
+*/
+CREATE TABLE phpbb_profile_lang (
+	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
+	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
+	lang_name varchar(255) DEFAULT '' NOT NULL,
+	lang_explain varchar(4000) DEFAULT '' NOT NULL,
+	lang_default_value varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (field_id, lang_id)
+);
+
+
+/*
+	Table: 'phpbb_ranks'
+*/
+CREATE SEQUENCE phpbb_ranks_seq;
+
+CREATE TABLE phpbb_ranks (
+	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
+	rank_title varchar(255) DEFAULT '' NOT NULL,
+	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
+	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
+	rank_image varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (rank_id)
+);
+
+
+/*
+	Table: 'phpbb_reports'
+*/
+CREATE SEQUENCE phpbb_reports_seq;
+
+CREATE TABLE phpbb_reports (
+	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
+	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
+	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
+	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
+	report_text TEXT DEFAULT '' NOT NULL,
+	reported_post_text TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (report_id)
+);
+
+CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
+CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
+
+/*
+	Table: 'phpbb_reports_reasons'
+*/
+CREATE SEQUENCE phpbb_reports_reasons_seq;
+
+CREATE TABLE phpbb_reports_reasons (
+	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
+	reason_title varchar(255) DEFAULT '' NOT NULL,
+	reason_description TEXT DEFAULT '' NOT NULL,
+	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
+	PRIMARY KEY (reason_id)
+);
+
+
+/*
+	Table: 'phpbb_search_results'
+*/
+CREATE TABLE phpbb_search_results (
+	search_key varchar(32) DEFAULT '' NOT NULL,
+	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
+	search_keywords TEXT DEFAULT '' NOT NULL,
+	search_authors TEXT DEFAULT '' NOT NULL,
+	PRIMARY KEY (search_key)
+);
+
+
+/*
+	Table: 'phpbb_search_wordlist'
+*/
+CREATE SEQUENCE phpbb_search_wordlist_seq;
+
+CREATE TABLE phpbb_search_wordlist (
+	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
+	word_text varchar(255) DEFAULT '' NOT NULL,
+	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
+	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
+	PRIMARY KEY (word_id)
+);
+
+CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
+CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
+
+/*
+	Table: 'phpbb_search_wordmatch'
+*/
+CREATE TABLE phpbb_search_wordmatch (
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
+	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
+);
+
+CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (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 '' NOT NULL,
+	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
+	session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0),
+	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
+	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
+	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
+	session_ip varchar(40) DEFAULT '' NOT NULL,
+	session_browser varchar(150) DEFAULT '' NOT NULL,
+	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
+	session_page varchar(255) DEFAULT '' NOT NULL,
+	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
+	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
+	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
+	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);
+CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id);
+
+/*
+	Table: 'phpbb_sessions_keys'
+*/
+CREATE TABLE phpbb_sessions_keys (
+	key_id char(32) DEFAULT '' NOT NULL,
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	last_ip varchar(40) DEFAULT '' NOT NULL,
+	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
+	PRIMARY KEY (key_id, user_id)
+);
+
+CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
+
+/*
+	Table: 'phpbb_sitelist'
+*/
+CREATE SEQUENCE phpbb_sitelist_seq;
+
+CREATE TABLE phpbb_sitelist (
+	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
+	site_ip varchar(40) DEFAULT '' NOT NULL,
+	site_hostname varchar(255) DEFAULT '' NOT NULL,
+	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
+	PRIMARY KEY (site_id)
+);
+
+
+/*
+	Table: 'phpbb_smilies'
+*/
+CREATE SEQUENCE phpbb_smilies_seq;
+
+CREATE TABLE phpbb_smilies (
+	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
+	code varchar(50) DEFAULT '' NOT NULL,
+	emotion varchar(50) DEFAULT '' NOT NULL,
+	smiley_url varchar(50) DEFAULT '' NOT NULL,
+	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
+	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
+	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
+	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
+	PRIMARY KEY (smiley_id)
+);
+
+CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
+
+/*
+	Table: 'phpbb_styles'
+*/
+CREATE SEQUENCE phpbb_styles_seq;
+
+CREATE TABLE phpbb_styles (
+	style_id INT4 DEFAULT nextval('phpbb_styles_seq'),
+	style_name varchar(255) DEFAULT '' NOT NULL,
+	style_copyright varchar(255) DEFAULT '' NOT NULL,
+	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
+	style_path varchar(100) DEFAULT '' NOT NULL,
+	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
+	style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0),
+	style_parent_tree varchar(8000) DEFAULT '' NOT NULL,
+	PRIMARY KEY (style_id)
+);
+
+CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
+
+/*
+	Table: 'phpbb_topics'
+*/
+CREATE SEQUENCE phpbb_topics_seq;
+
+CREATE TABLE phpbb_topics (
+	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
+	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
+	topic_visibility INT2 DEFAULT '0' NOT NULL,
+	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
+	topic_title varchar(255) DEFAULT '' NOT NULL,
+	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
+	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
+	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
+	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
+	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
+	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
+	topic_status INT2 DEFAULT '0' NOT NULL,
+	topic_type INT2 DEFAULT '0' NOT NULL,
+	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
+	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
+	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
+	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
+	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
+	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
+	topic_last_post_subject varchar(255) DEFAULT '' NOT NULL,
+	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
+	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
+	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
+	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
+	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
+	poll_title varchar(255) DEFAULT '' NOT NULL,
+	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
+	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
+	poll_max_options INT2 DEFAULT '1' NOT NULL,
+	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
+	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
+	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_visibility ON phpbb_topics (topic_visibility);
+CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id);
+CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id);
+
+/*
+	Table: 'phpbb_topics_track'
+*/
+CREATE TABLE phpbb_topics_track (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
+	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
+	PRIMARY KEY (user_id, topic_id)
+);
+
+CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (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 INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
+	PRIMARY KEY (user_id, topic_id)
+);
+
+
+/*
+	Table: 'phpbb_topics_watch'
+*/
+CREATE TABLE phpbb_topics_watch (
+	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
+);
+
+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 INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
+	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
+);
+
+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 SEQUENCE phpbb_users_seq;
+
+CREATE TABLE phpbb_users (
+	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
+	user_type INT2 DEFAULT '0' NOT NULL,
+	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
+	user_permissions TEXT DEFAULT '' NOT NULL,
+	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
+	user_ip varchar(40) DEFAULT '' NOT NULL,
+	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
+	username varchar_ci DEFAULT '' NOT NULL,
+	username_clean varchar_ci DEFAULT '' NOT NULL,
+	user_password varchar(40) DEFAULT '' NOT NULL,
+	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
+	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
+	user_email varchar(100) DEFAULT '' NOT NULL,
+	user_email_hash INT8 DEFAULT '0' NOT NULL,
+	user_birthday varchar(10) DEFAULT '' NOT NULL,
+	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
+	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
+	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
+	user_lastpage varchar(200) DEFAULT '' NOT NULL,
+	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
+	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
+	user_warnings INT2 DEFAULT '0' NOT NULL,
+	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
+	user_login_attempts INT2 DEFAULT '0' NOT NULL,
+	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
+	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
+	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
+	user_lang varchar(30) DEFAULT '' NOT NULL,
+	user_timezone varchar(100) DEFAULT 'UTC' NOT NULL,
+	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
+	user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
+	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
+	user_colour varchar(6) DEFAULT '' NOT NULL,
+	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
+	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
+	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
+	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
+	user_full_folder INT4 DEFAULT '-3' NOT NULL,
+	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
+	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
+	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
+	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
+	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
+	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
+	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
+	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
+	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
+	user_notify_type INT2 DEFAULT '0' NOT NULL,
+	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
+	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
+	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
+	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
+	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
+	user_avatar varchar(255) DEFAULT '' NOT NULL,
+	user_avatar_type INT2 DEFAULT '0' NOT NULL,
+	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
+	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
+	user_sig TEXT DEFAULT '' NOT NULL,
+	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
+	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
+	user_from varchar(100) DEFAULT '' NOT NULL,
+	user_icq varchar(15) DEFAULT '' NOT NULL,
+	user_aim varchar(255) DEFAULT '' NOT NULL,
+	user_yim varchar(255) DEFAULT '' NOT NULL,
+	user_msnm varchar(255) DEFAULT '' NOT NULL,
+	user_jabber varchar(255) DEFAULT '' NOT NULL,
+	user_website varchar(200) DEFAULT '' NOT NULL,
+	user_occ varchar(4000) DEFAULT '' NOT NULL,
+	user_interests varchar(4000) DEFAULT '' NOT NULL,
+	user_actkey varchar(32) DEFAULT '' NOT NULL,
+	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
+	user_form_salt varchar(32) DEFAULT '' NOT NULL,
+	user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0),
+	user_reminded INT2 DEFAULT '0' NOT NULL,
+	user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0),
+	PRIMARY KEY (user_id)
+);
+
+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 UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
+
+/*
+	Table: 'phpbb_warnings'
+*/
+CREATE SEQUENCE phpbb_warnings_seq;
+
+CREATE TABLE phpbb_warnings (
+	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
+	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
+	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
+	PRIMARY KEY (warning_id)
+);
+
+
+/*
+	Table: 'phpbb_words'
+*/
+CREATE SEQUENCE phpbb_words_seq;
+
+CREATE TABLE phpbb_words (
+	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
+	word varchar(255) DEFAULT '' NOT NULL,
+	replacement varchar(255) DEFAULT '' NOT NULL,
+	PRIMARY KEY (word_id)
+);
+
+
+/*
+	Table: 'phpbb_zebra'
+*/
+CREATE TABLE phpbb_zebra (
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
+	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
+	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
+	PRIMARY KEY (user_id, zebra_id)
+);
+
+
+
+COMMIT;
\ No newline at end of file
-- 
cgit v1.2.1


From dc2835af785c6bf0209d91791f27a931fb334a5b Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Fri, 28 Sep 2012 16:17:21 +0200
Subject: [feature/soft-delete] Add columns for soft delete details

PHPBB3-9657
---
 phpBB/install/schemas/postgres_schema.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 44440898e2..ea920ccd5e 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -655,6 +655,9 @@ CREATE TABLE phpbb_posts (
 	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
 	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
 	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
+	post_delete_time INT4 DEFAULT '0' NOT NULL CHECK (post_delete_time >= 0),
+	post_delete_reason varchar(255) DEFAULT '' NOT NULL,
+	post_delete_user INT4 DEFAULT '0' NOT NULL CHECK (post_delete_user >= 0),
 	PRIMARY KEY (post_id)
 );
 
@@ -1045,6 +1048,9 @@ CREATE TABLE phpbb_topics (
 	poll_max_options INT2 DEFAULT '1' NOT NULL,
 	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
 	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
+	topic_delete_time INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_time >= 0),
+	topic_delete_reason varchar(255) DEFAULT '' NOT NULL,
+	topic_delete_user INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_user >= 0),
 	PRIMARY KEY (topic_id)
 );
 
-- 
cgit v1.2.1


From fa605402f79e54c5ac5e1af4f08683c1c17d5201 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Thu, 4 Oct 2012 20:48:19 -0500
Subject: [ticket/11103] Create schema files with notification tables

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 38 +++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 659a32bf19..d8716be70d 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -596,6 +596,30 @@ 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);
 
+/*
+	Table: 'phpbb_notifications'
+*/
+CREATE SEQUENCE phpbb_notifications_seq;
+
+CREATE TABLE phpbb_notifications (
+	notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'),
+	item_type varchar(25) DEFAULT '' NOT NULL,
+	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
+	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
+	time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0),
+	data varchar(4000) DEFAULT '' NOT NULL,
+	PRIMARY KEY (notification_id)
+);
+
+CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications (item_type);
+CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications (item_id);
+CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id);
+CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id);
+CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time);
+CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread);
+
 /*
 	Table: 'phpbb_poll_options'
 */
@@ -1093,6 +1117,20 @@ 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_notifications'
+*/
+CREATE TABLE phpbb_user_notifications (
+	item_type varchar(25) DEFAULT '' NOT NULL,
+	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
+	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+	method varchar(25) DEFAULT '' NOT NULL,
+	PRIMARY KEY (item_type, item_id, user_id, method)
+);
+
+CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
+CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
+
 /*
 	Table: 'phpbb_user_group'
 */
-- 
cgit v1.2.1


From 94ffbb4050b2985ee62be0ecc0c6a244532e43ca Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 13 Oct 2012 23:24:30 -0500
Subject: [ticket/11103] Add is_disabled column to notifications table

EXTENSION AUTHORS TAKE NOTE! This is to prevent errors with notifications
from extensions!

Set is_disabled to 1 for all your notifications when your extension is
disabled so they are ignored and do not cause errors.

When your extension is enabled again, set is_disabled to 0 and your
notifications will be working again.

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index d8716be70d..ffba657475 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -608,6 +608,7 @@ CREATE TABLE phpbb_notifications (
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
+	is_disabled INT2 DEFAULT '0' NOT NULL CHECK (is_disabled >= 0),
 	time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0),
 	data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
@@ -619,6 +620,7 @@ CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id
 CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id);
 CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time);
 CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread);
+CREATE INDEX phpbb_notifications_is_disabled ON phpbb_notifications (is_disabled);
 
 /*
 	Table: 'phpbb_poll_options'
-- 
cgit v1.2.1


From 94d682f77431add84867bb0b196ad0719b293606 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 20 Oct 2012 20:54:18 -0500
Subject: [ticket/11103] Use the full class name as the item_type/method

This is going to require you recreate the db tables.

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index ffba657475..784e3c8c68 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -603,12 +603,12 @@ CREATE SEQUENCE phpbb_notifications_seq;
 
 CREATE TABLE phpbb_notifications (
 	notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'),
-	item_type varchar(25) DEFAULT '' NOT NULL,
+	item_type varchar(255) DEFAULT '' NOT NULL,
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
-	is_disabled INT2 DEFAULT '0' NOT NULL CHECK (is_disabled >= 0),
+	is_enabled INT2 DEFAULT '1' NOT NULL CHECK (is_enabled >= 0),
 	time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0),
 	data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
@@ -620,7 +620,7 @@ CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id
 CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id);
 CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time);
 CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread);
-CREATE INDEX phpbb_notifications_is_disabled ON phpbb_notifications (is_disabled);
+CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications (is_enabled);
 
 /*
 	Table: 'phpbb_poll_options'
@@ -1123,10 +1123,10 @@ CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status
 	Table: 'phpbb_user_notifications'
 */
 CREATE TABLE phpbb_user_notifications (
-	item_type varchar(25) DEFAULT '' NOT NULL,
+	item_type varchar(255) DEFAULT '' NOT NULL,
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	method varchar(25) DEFAULT '' NOT NULL,
+	method varchar(255) DEFAULT '' NOT NULL,
 	PRIMARY KEY (item_type, item_id, user_id, method)
 );
 
-- 
cgit v1.2.1


From 9c5482317ecf749012fc76e925b9fe1a07a1963b Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Sun, 21 Oct 2012 22:33:28 +0200
Subject: [feature/soft-delete] Add new fields for topic/post counts for
 softdelete

We can not use the replies vs replies_real anymore, as we need to be able to
determinate whether the posts are unapproved or softdeleted. So we need to add
a new field and there by change the second one for consistency.
We also add the posts_* fields for forums, which are a missing feature.

PHPBB3-9567
---
 phpBB/install/schemas/postgres_schema.sql | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index ea920ccd5e..a8289940a9 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -386,8 +386,11 @@ CREATE TABLE phpbb_forums (
 	forum_type INT2 DEFAULT '0' NOT NULL,
 	forum_status INT2 DEFAULT '0' NOT NULL,
 	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
+	forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0),
+	forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0),
 	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
-	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
+	forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0),
+	forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0),
 	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
 	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
 	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
@@ -1025,8 +1028,9 @@ CREATE TABLE phpbb_topics (
 	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
 	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
 	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
-	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
-	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
+	topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0),
+	topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0),
+	topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0),
 	topic_status INT2 DEFAULT '0' NOT NULL,
 	topic_type INT2 DEFAULT '0' NOT NULL,
 	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
-- 
cgit v1.2.1


From e549b7663da47d7518b93074e513c7e1d034bf52 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Mon, 29 Oct 2012 18:09:20 -0500
Subject: [ticket/11103] Set basic notifications to be enabled by default

Now, if there is no row for the user in the user_notifications table,
the user will receive basic notifications. If the user wishes to not
receive notifications, a row must be added with notify = 0.

For other methods besides the basic (e.g. email, jabber) a row must
still be added with notify = 1 for them to receive notifications

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 784e3c8c68..263a9884b7 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1127,11 +1127,13 @@ CREATE TABLE phpbb_user_notifications (
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	method varchar(255) DEFAULT '' NOT NULL,
+	notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0),
 	PRIMARY KEY (item_type, item_id, user_id, method)
 );
 
 CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
 CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
+CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
 
 /*
 	Table: 'phpbb_user_group'
-- 
cgit v1.2.1


From 9c2a58eff4c2bd164ee3bdb2ec66729d4562963d Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Fri, 9 Nov 2012 13:37:53 +0100
Subject: [feature/soft-delete] Append _approved to *_posts and *_topics column
 names

PHPBB3-9567
---
 phpBB/install/schemas/postgres_schema.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index a8289940a9..0235c25267 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -385,10 +385,10 @@ CREATE TABLE phpbb_forums (
 	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
 	forum_type INT2 DEFAULT '0' NOT NULL,
 	forum_status INT2 DEFAULT '0' NOT NULL,
-	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
+	forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0),
 	forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0),
 	forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0),
-	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
+	forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0),
 	forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0),
 	forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0),
 	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
@@ -1028,7 +1028,7 @@ CREATE TABLE phpbb_topics (
 	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
 	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
 	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
-	topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0),
+	topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0),
 	topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0),
 	topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0),
 	topic_status INT2 DEFAULT '0' NOT NULL,
-- 
cgit v1.2.1


From df735f46033a92657dce004c2d5ece6866565208 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Tue, 13 Nov 2012 11:29:25 +0100
Subject: [ticket/10411] Add new table for teampage

PHPBB3-10411
---
 phpBB/install/schemas/postgres_schema.sql | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 619985e0d6..15d50035d6 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -855,8 +855,8 @@ CREATE TABLE phpbb_reports (
 	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
 	report_text TEXT DEFAULT '' NOT NULL,
 	reported_post_text TEXT DEFAULT '' NOT NULL,
-	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
+	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	PRIMARY KEY (report_id)
 );
 
@@ -1007,6 +1007,21 @@ CREATE TABLE phpbb_styles (
 
 CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
 
+/*
+	Table: 'phpbb_teampage'
+*/
+CREATE SEQUENCE phpbb_teampage_seq;
+
+CREATE TABLE phpbb_teampage (
+	teampage_id INT4 DEFAULT nextval('phpbb_teampage_seq'),
+	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
+	teampage_name varchar(255) DEFAULT '' NOT NULL,
+	teampage_position INT4 DEFAULT '0' NOT NULL CHECK (teampage_position >= 0),
+	teampage_parent INT4 DEFAULT '0' NOT NULL CHECK (teampage_parent >= 0),
+	PRIMARY KEY (teampage_id)
+);
+
+
 /*
 	Table: 'phpbb_topics'
 */
-- 
cgit v1.2.1


From 8fc022033a16b50aa07d06af8dc2a2508f0d94a6 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Tue, 13 Nov 2012 16:24:02 +0100
Subject: [ticket/10411] Update schema and fix database update

PHPBB3-10411
---
 phpBB/install/schemas/postgres_schema.sql | 1 -
 1 file changed, 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 15d50035d6..1e8d390b99 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -473,7 +473,6 @@ CREATE TABLE phpbb_groups (
 	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
 	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
 	group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
-	group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
 	PRIMARY KEY (group_id)
 );
 
-- 
cgit v1.2.1


From 562ebe5c12b8a238b94a63ba53b694af4d061bc9 Mon Sep 17 00:00:00 2001
From: Marc Alexander <admin@m-a-styles.de>
Date: Fri, 30 Nov 2012 14:36:18 +0100
Subject: [feature/avatars] Unify size of avatar_type

Previously it was set to 255 in one file while it was 32 in other files.
As the size of 32 is rather low this was increased to 255.

PHPBB3-10018
---
 phpBB/install/schemas/postgres_schema.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index f85cee4277..3d4d01484e 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -463,7 +463,7 @@ CREATE TABLE phpbb_groups (
 	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
 	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
 	group_avatar varchar(255) DEFAULT '' NOT NULL,
-	group_avatar_type varchar(32) DEFAULT '' NOT NULL,
+	group_avatar_type varchar(255) DEFAULT '' NOT NULL,
 	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
 	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
 	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
@@ -1169,7 +1169,7 @@ CREATE TABLE phpbb_users (
 	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
 	user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
 	user_avatar varchar(255) DEFAULT '' NOT NULL,
-	user_avatar_type varchar(32) DEFAULT '' NOT NULL,
+	user_avatar_type varchar(255) DEFAULT '' NOT NULL,
 	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
 	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
 	user_sig TEXT DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From 9b018bd460376abce3f4fe9d8c11feef0c547b0d Mon Sep 17 00:00:00 2001
From: Bruno Ais <brunoaiss@gmail.com>
Date: Sun, 2 Dec 2012 21:47:18 +0000
Subject: [ticket/11171] DB additions for these changes

Made the required changes to develop/create_schema_files.php
and this is what resulted of that.

PHPBB3-11171
---
 phpBB/install/schemas/postgres_schema.sql | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 619985e0d6..4c13bf0ba9 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -855,8 +855,11 @@ CREATE TABLE phpbb_reports (
 	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
 	report_text TEXT DEFAULT '' NOT NULL,
 	reported_post_text TEXT DEFAULT '' NOT NULL,
-	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
+	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
+	reported_post_enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_magic_url >= 0),
+	reported_post_enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_smilies >= 0),
+	reported_post_enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_bbcode >= 0),
 	PRIMARY KEY (report_id)
 );
 
-- 
cgit v1.2.1


From 0d6c8f46ffa1206e9d8d71fd30ef04e52f7cb2a8 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 8 Dec 2012 14:12:25 -0600
Subject: [ticket/11103] Update indexes on notifications/user notifications
 tables

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 94926d0b7a..e43b64468d 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -614,13 +614,8 @@ CREATE TABLE phpbb_notifications (
 	PRIMARY KEY (notification_id)
 );
 
-CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications (item_type);
-CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications (item_id);
-CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id);
-CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id);
-CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time);
-CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread);
-CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications (is_enabled);
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, unread);
 
 /*
 	Table: 'phpbb_poll_options'
-- 
cgit v1.2.1


From f47e51d6dea9d59a36a6babf1f4033104c93a53d Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 15 Dec 2012 19:18:26 -0600
Subject: [ticket/11103] Move is_enabled to a separate table for better
 performance

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index e43b64468d..05533fc731 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -596,6 +596,16 @@ 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);
 
+/*
+	Table: 'phpbb_notification_types'
+*/
+CREATE TABLE phpbb_notification_types (
+	notification_type varchar(255) DEFAULT '' NOT NULL,
+	notification_type_enabled INT2 DEFAULT '1' NOT NULL CHECK (notification_type_enabled >= 0),
+	PRIMARY KEY (notification_type, notification_type_enabled)
+);
+
+
 /*
 	Table: 'phpbb_notifications'
 */
@@ -608,7 +618,6 @@ CREATE TABLE phpbb_notifications (
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
-	is_enabled INT2 DEFAULT '1' NOT NULL CHECK (is_enabled >= 0),
 	time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0),
 	data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
@@ -1128,9 +1137,6 @@ CREATE TABLE phpbb_user_notifications (
 	PRIMARY KEY (item_type, item_id, user_id, method)
 );
 
-CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
-CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
-CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
 
 /*
 	Table: 'phpbb_user_group'
-- 
cgit v1.2.1


From 47bed3321634d888a51a611e6586c012a27eb1eb Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 15 Dec 2012 21:02:28 -0600
Subject: [ticket/11103] time -> notification_time

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 05533fc731..6d9a910912 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -618,7 +618,7 @@ CREATE TABLE phpbb_notifications (
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
-	time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0),
+	notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0),
 	data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
 );
-- 
cgit v1.2.1


From fad6bc5a7e58ddd370b88f73712de350b61bca29 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 15 Dec 2012 21:08:26 -0600
Subject: [ticket/11103] unread -> notification_read

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 6d9a910912..504ffe8282 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -617,14 +617,14 @@ CREATE TABLE phpbb_notifications (
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
-	unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
+	notification_read INT2 DEFAULT '0' NOT NULL CHECK (notification_read >= 0),
 	notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0),
 	data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
 );
 
 CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
-CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, unread);
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
 
 /*
 	Table: 'phpbb_poll_options'
-- 
cgit v1.2.1


From eeb40181956b578ca98ed0106f3019d8c8299ed3 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Sat, 15 Dec 2012 21:17:05 -0600
Subject: [ticket/11103] data -> notification_data

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 504ffe8282..1035dd1ce8 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -619,7 +619,7 @@ CREATE TABLE phpbb_notifications (
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	notification_read INT2 DEFAULT '0' NOT NULL CHECK (notification_read >= 0),
 	notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0),
-	data varchar(4000) DEFAULT '' NOT NULL,
+	notification_data varchar(4000) DEFAULT '' NOT NULL,
 	PRIMARY KEY (notification_id)
 );
 
-- 
cgit v1.2.1


From f817e20f287a21e2dddfba9721f5e02dce162d29 Mon Sep 17 00:00:00 2001
From: Nils Adermann <naderman@naderman.de>
Date: Fri, 15 Jul 2011 11:57:53 -0400
Subject: [feature/migrations] Basic migrations with schema and data changes

The migrator takes care of applying migrations as necessary.

RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41337

PHPBB3-9737
---
 phpBB/install/schemas/postgres_schema.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 619985e0d6..ef138dac0f 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -557,6 +557,20 @@ CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwa
 CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
 CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
 
+/*
+	Table: 'phpbb_migrations'
+*/
+CREATE TABLE phpbb_migrations (
+	migration_name varchar(255) DEFAULT '' NOT NULL,
+	migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0),
+	migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0),
+	migration_data_state varchar(8000) DEFAULT '' NOT NULL,
+	migration_start_time INT4 DEFAULT '0' NOT NULL CHECK (migration_start_time >= 0),
+	migration_end_time INT4 DEFAULT '0' NOT NULL CHECK (migration_end_time >= 0)
+);
+
+CREATE UNIQUE INDEX phpbb_migrations_migration_name ON phpbb_migrations (migration_name);
+
 /*
 	Table: 'phpbb_moderator_cache'
 */
-- 
cgit v1.2.1


From 5c91e2569cb3a400acd20bf06cc0e609dd63a778 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Tue, 8 Jan 2013 22:09:14 -0600
Subject: [feature/migrations] Migrations now somewhat works

PHPBB3-9737
---
 phpBB/install/schemas/postgres_schema.sql | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index ef138dac0f..c976659f05 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -557,20 +557,6 @@ CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwa
 CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time);
 CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id);
 
-/*
-	Table: 'phpbb_migrations'
-*/
-CREATE TABLE phpbb_migrations (
-	migration_name varchar(255) DEFAULT '' NOT NULL,
-	migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0),
-	migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0),
-	migration_data_state varchar(8000) DEFAULT '' NOT NULL,
-	migration_start_time INT4 DEFAULT '0' NOT NULL CHECK (migration_start_time >= 0),
-	migration_end_time INT4 DEFAULT '0' NOT NULL CHECK (migration_end_time >= 0)
-);
-
-CREATE UNIQUE INDEX phpbb_migrations_migration_name ON phpbb_migrations (migration_name);
-
 /*
 	Table: 'phpbb_moderator_cache'
 */
@@ -586,6 +572,20 @@ CREATE TABLE phpbb_moderator_cache (
 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_migrations'
+*/
+CREATE TABLE phpbb_migrations (
+	migration_name varchar(255) DEFAULT '' NOT NULL,
+	migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0),
+	migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0),
+	migration_data_state varchar(8000) DEFAULT '' NOT NULL,
+	migration_start_time INT4 DEFAULT '0' NOT NULL CHECK (migration_start_time >= 0),
+	migration_end_time INT4 DEFAULT '0' NOT NULL CHECK (migration_end_time >= 0),
+	PRIMARY KEY (migration_name)
+);
+
+
 /*
 	Table: 'phpbb_modules'
 */
@@ -869,8 +869,8 @@ CREATE TABLE phpbb_reports (
 	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
 	report_text TEXT DEFAULT '' NOT NULL,
 	reported_post_text TEXT DEFAULT '' NOT NULL,
-	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
+	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	PRIMARY KEY (report_id)
 );
 
-- 
cgit v1.2.1


From d50500860fe44a78c8f29e0f2382b96da17c0b62 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Thu, 10 Jan 2013 15:09:51 -0600
Subject: [feature/migrations] Store depends on in the database (serialized)

This is required so that when migrations are reverted we can check through
all installed migrations and make sure that all dependencies are handled
properly and so that we are only required to load the migrations files
that could be dependent on the ones installed.

I believe in normal proper use the old way might have worked, but in case
something happens and an unrelated migration file is installed, but cannot
be loaded, this makes sure we do not stop everything unless we absolutely
must (one of those files is dependent on something we want to revert).

PHPBB3-9737
---
 phpBB/install/schemas/postgres_schema.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index c976659f05..9fd81ec06a 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -577,6 +577,7 @@ CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id);
 */
 CREATE TABLE phpbb_migrations (
 	migration_name varchar(255) DEFAULT '' NOT NULL,
+	migration_depends_on varchar(8000) DEFAULT '' NOT NULL,
 	migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0),
 	migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0),
 	migration_data_state varchar(8000) DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From 032f172a073b028f5d1585f997859f7a07c00c98 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Fri, 11 Jan 2013 14:27:05 +0100
Subject: [ticket/11321] Recreate schema files with
 develop/create_schema_files.php

PHPBB3-11321
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 619985e0d6..2acdeb7f45 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -855,8 +855,8 @@ CREATE TABLE phpbb_reports (
 	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
 	report_text TEXT DEFAULT '' NOT NULL,
 	reported_post_text TEXT DEFAULT '' NOT NULL,
-	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
+	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
 	PRIMARY KEY (report_id)
 );
 
-- 
cgit v1.2.1


From 9affd6f7e7b95442f1ef14894858d8213f3fbd2a Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Fri, 11 Jan 2013 00:41:03 +0100
Subject: [ticket/11201] Remove MSN/WLM fields

WLM will be shutdown in March 2013. Skype is the new replacement. But as Skype
uses a different login ID and service, the values in this field are useless.
So we can safely remove the field and the links/functions we create.

PHPBB3-11201
---
 phpBB/install/schemas/postgres_schema.sql | 1 -
 1 file changed, 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 2acdeb7f45..a6c989fe62 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1179,7 +1179,6 @@ CREATE TABLE phpbb_users (
 	user_icq varchar(15) DEFAULT '' NOT NULL,
 	user_aim varchar(255) DEFAULT '' NOT NULL,
 	user_yim varchar(255) DEFAULT '' NOT NULL,
-	user_msnm varchar(255) DEFAULT '' NOT NULL,
 	user_jabber varchar(255) DEFAULT '' NOT NULL,
 	user_website varchar(200) DEFAULT '' NOT NULL,
 	user_occ varchar(4000) DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From b567e0963099b911e0d1d7b262c777a6969aad1f Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Thu, 31 Jan 2013 10:14:42 -0600
Subject: [ticket/11103] Remove Primary Key on user_notifications table

PHPBB3-11103
---
 phpBB/install/schemas/postgres_schema.sql | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 426f2decbf..8892357805 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1136,8 +1136,7 @@ CREATE TABLE phpbb_user_notifications (
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	method varchar(255) DEFAULT '' NOT NULL,
-	notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0),
-	PRIMARY KEY (item_type, item_id, user_id, method)
+	notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0)
 );
 
 
-- 
cgit v1.2.1


From 336187151a2010197ddda1bcdabc311fd10c1c87 Mon Sep 17 00:00:00 2001
From: Andreas Fischer <bantu@phpbb.com>
Date: Mon, 4 Feb 2013 01:30:04 +0100
Subject: [ticket/11201] Revert WLM dropping because it is still used in China.

Windows Live Messenger is still in use in china which accounts for ~20% of world
population. Revert WLM dropping which has been merged under the assumption that
WLM data and features are completely useless.

This commit reverts commits
 - 460470229d972b93ef5a98b0d1d97a2a970d684f
 - 9affd6f7e7b95442f1ef14894858d8213f3fbd2a
which have been merged by d59431691c27c73fba8ae9934b84b34a13280dd2.

PHPBB3-11201
---
 phpBB/install/schemas/postgres_schema.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 301654bf25..4c13bf0ba9 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1182,6 +1182,7 @@ CREATE TABLE phpbb_users (
 	user_icq varchar(15) DEFAULT '' NOT NULL,
 	user_aim varchar(255) DEFAULT '' NOT NULL,
 	user_yim varchar(255) DEFAULT '' NOT NULL,
+	user_msnm varchar(255) DEFAULT '' NOT NULL,
 	user_jabber varchar(255) DEFAULT '' NOT NULL,
 	user_website varchar(200) DEFAULT '' NOT NULL,
 	user_occ varchar(4000) DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From 3cee183dd4882fdd00deb911bab69287d7754135 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Wed, 27 Feb 2013 12:51:34 +0100
Subject: [ticket/9657] Break the schemas again to avoid merge conflicts

PHPBB3-9657
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index cfe2519556..b45e40ed56 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -861,8 +861,8 @@ CREATE TABLE phpbb_reports (
 	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
 	report_text TEXT DEFAULT '' NOT NULL,
 	reported_post_text TEXT DEFAULT '' NOT NULL,
-	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
 	reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
+	reported_post_uid varchar(8) DEFAULT '' NOT NULL,
 	PRIMARY KEY (report_id)
 );
 
-- 
cgit v1.2.1


From 3a5d3bdd686e93539d51d8f1a78a5489192f73ef Mon Sep 17 00:00:00 2001
From: Andreas Fischer <bantu@phpbb.com>
Date: Tue, 5 Mar 2013 02:22:09 +0100
Subject: [ticket/10202] Add database schema for phpbb_config_db_text.

PHPBB3-10202
---
 phpBB/install/schemas/postgres_schema.sql | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 77481add59..c0df97bd8f 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -269,6 +269,16 @@ CREATE TABLE phpbb_config (
 
 CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic);
 
+/*
+	Table: 'phpbb_config_text'
+*/
+CREATE TABLE phpbb_config_text (
+	config_name varchar(255) DEFAULT '' NOT NULL,
+	config_value varchar(8000) DEFAULT '' NOT NULL,
+	PRIMARY KEY (config_name)
+);
+
+
 /*
 	Table: 'phpbb_confirm'
 */
-- 
cgit v1.2.1


From 5158224845d4d21fc3d4bbb62ff3e0d798285071 Mon Sep 17 00:00:00 2001
From: Andreas Fischer <bantu@phpbb.com>
Date: Tue, 5 Mar 2013 22:39:41 +0100
Subject: [ticket/10202] Upgrade TEXT to the bigger MTEXT.

PHPBB3-10202
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index c0df97bd8f..6dc507b46d 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -274,7 +274,7 @@ CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic);
 */
 CREATE TABLE phpbb_config_text (
 	config_name varchar(255) DEFAULT '' NOT NULL,
-	config_value varchar(8000) DEFAULT '' NOT NULL,
+	config_value TEXT DEFAULT '' NOT NULL,
 	PRIMARY KEY (config_name)
 );
 
-- 
cgit v1.2.1


From 198b992dcef0a0a7099eb3db6185d567b58b6e5a Mon Sep 17 00:00:00 2001
From: Nathaniel Guse <nathaniel.guse@gmail.com>
Date: Sun, 28 Apr 2013 22:53:05 -0500
Subject: [ticket/11413] Schema changes and migration file

Notifications tables are dropped because phpBB currently does not have
any way to make the necessary changes to the DB schema (and no release
has yet been made with these changes).

This will fix the following bugs:
PHPBB3-11411
PHPBB3-11413
PHPBB3-11414
PHPBB3-11416
PHPBB3-11420

PHPBB3-11413
---
 phpBB/install/schemas/postgres_schema.sql | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 6dc507b46d..cd6de434b5 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -623,12 +623,16 @@ CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id
 /*
 	Table: 'phpbb_notification_types'
 */
+CREATE SEQUENCE phpbb_notification_types_seq;
+
 CREATE TABLE phpbb_notification_types (
-	notification_type varchar(255) DEFAULT '' NOT NULL,
+	notification_type_id INT2 DEFAULT nextval('phpbb_notification_types_seq'),
+	notification_type_name varchar(255) DEFAULT '' NOT NULL,
 	notification_type_enabled INT2 DEFAULT '1' NOT NULL CHECK (notification_type_enabled >= 0),
-	PRIMARY KEY (notification_type, notification_type_enabled)
+	PRIMARY KEY (notification_type_id)
 );
 
+CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name);
 
 /*
 	Table: 'phpbb_notifications'
@@ -637,7 +641,7 @@ CREATE SEQUENCE phpbb_notifications_seq;
 
 CREATE TABLE phpbb_notifications (
 	notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'),
-	item_type varchar(255) DEFAULT '' NOT NULL,
+	notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0),
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
@@ -647,7 +651,7 @@ CREATE TABLE phpbb_notifications (
 	PRIMARY KEY (notification_id)
 );
 
-CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id);
 CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
 
 /*
@@ -1171,7 +1175,7 @@ CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status
 	Table: 'phpbb_user_notifications'
 */
 CREATE TABLE phpbb_user_notifications (
-	item_type varchar(255) DEFAULT '' NOT NULL,
+	notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0),
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	method varchar(255) DEFAULT '' NOT NULL,
-- 
cgit v1.2.1


From 33287a73609a99f33f3d0718fceaf72e39d5283e Mon Sep 17 00:00:00 2001
From: Nathaniel Guse <nathaniel.guse@gmail.com>
Date: Mon, 29 Apr 2013 21:22:07 -0500
Subject: [ticket/11413] Undo editing the user_notifications table

item_type is not equivalent to notification_type_name, it can be a generic
string (typically used to be able to subscribe to multiple notification
types while only subscribing to one item

PHPBB3-11413
---
 phpBB/install/schemas/postgres_schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/install/schemas/postgres_schema.sql')

diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index cd6de434b5..fea5700167 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1175,7 +1175,7 @@ CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status
 	Table: 'phpbb_user_notifications'
 */
 CREATE TABLE phpbb_user_notifications (
-	notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0),
+	item_type varchar(255) DEFAULT '' NOT NULL,
 	item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
 	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
 	method varchar(255) DEFAULT '' NOT NULL,
-- 
cgit v1.2.1

