Blame Identity/Webenv/phpBB/3.0.4/install/schemas/postgres_schema.sql

ef5584
/*
ef5584
ef5584
 $Id: postgres_schema.sql 9129 2008-11-27 13:44:24Z acydburn $
ef5584
ef5584
*/
ef5584
ef5584
BEGIN;
ef5584
ef5584
/*
ef5584
	Domain definition
ef5584
*/
ef5584
CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
ef5584
ef5584
/*
ef5584
	Operation Functions
ef5584
*/
ef5584
CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
ef5584
CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
ef5584
CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
ef5584
CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
ef5584
CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
ef5584
CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
ef5584
ef5584
/*
ef5584
	Operators
ef5584
*/
ef5584
CREATE OPERATOR <(
ef5584
  PROCEDURE = _varchar_ci_less_than,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = >,
ef5584
  NEGATOR = >=,
ef5584
  RESTRICT = scalarltsel,
ef5584
  JOIN = scalarltjoinsel);
ef5584
ef5584
CREATE OPERATOR <=(
ef5584
  PROCEDURE = _varchar_ci_less_equal,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = >=,
ef5584
  NEGATOR = >,
ef5584
  RESTRICT = scalarltsel,
ef5584
  JOIN = scalarltjoinsel);
ef5584
ef5584
CREATE OPERATOR >(
ef5584
  PROCEDURE = _varchar_ci_greater_than,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = <,
ef5584
  NEGATOR = <=,
ef5584
  RESTRICT = scalargtsel,
ef5584
  JOIN = scalargtjoinsel);
ef5584
ef5584
CREATE OPERATOR >=(
ef5584
  PROCEDURE = _varchar_ci_greater_equals,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = <=,
ef5584
  NEGATOR = <,
ef5584
  RESTRICT = scalargtsel,
ef5584
  JOIN = scalargtjoinsel);
ef5584
ef5584
CREATE OPERATOR <>(
ef5584
  PROCEDURE = _varchar_ci_not_equal,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = <>,
ef5584
  NEGATOR = =,
ef5584
  RESTRICT = neqsel,
ef5584
  JOIN = neqjoinsel);
ef5584
ef5584
CREATE OPERATOR =(
ef5584
  PROCEDURE = _varchar_ci_equal,
ef5584
  LEFTARG = varchar_ci,
ef5584
  RIGHTARG = varchar_ci,
ef5584
  COMMUTATOR = =,
ef5584
  NEGATOR = <>,
ef5584
  RESTRICT = eqsel,
ef5584
  JOIN = eqjoinsel,
ef5584
  HASHES,
ef5584
  MERGES,
ef5584
  SORT1= <);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_attachments'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_attachments_seq;
ef5584
ef5584
CREATE TABLE phpbb_attachments (
ef5584
	attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'),
ef5584
	post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0),
ef5584
	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
ef5584
	is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0),
ef5584
	physical_filename varchar(255) DEFAULT '' NOT NULL,
ef5584
	real_filename varchar(255) DEFAULT '' NOT NULL,
ef5584
	download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0),
ef5584
	attach_comment varchar(4000) DEFAULT '' NOT NULL,
ef5584
	extension varchar(100) DEFAULT '' NOT NULL,
ef5584
	mimetype varchar(100) DEFAULT '' NOT NULL,
ef5584
	filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0),
ef5584
	filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0),
ef5584
	thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0),
ef5584
	PRIMARY KEY (attach_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime);
ef5584
CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id);
ef5584
CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id);
ef5584
CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id);
ef5584
CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_acl_groups'
ef5584
*/
ef5584
CREATE TABLE phpbb_acl_groups (
ef5584
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
ef5584
	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
ef5584
	auth_setting INT2 DEFAULT '0' NOT NULL
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id);
ef5584
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id);
ef5584
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_acl_options'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_acl_options_seq;
ef5584
ef5584
CREATE TABLE phpbb_acl_options (
ef5584
	auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'),
ef5584
	auth_option varchar(50) DEFAULT '' NOT NULL,
ef5584
	is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0),
ef5584
	is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0),
ef5584
	founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0),
ef5584
	PRIMARY KEY (auth_option_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_acl_roles'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_acl_roles_seq;
ef5584
ef5584
CREATE TABLE phpbb_acl_roles (
ef5584
	role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'),
ef5584
	role_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	role_description varchar(4000) DEFAULT '' NOT NULL,
ef5584
	role_type varchar(10) DEFAULT '' NOT NULL,
ef5584
	role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0),
ef5584
	PRIMARY KEY (role_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type);
ef5584
CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_acl_roles_data'
ef5584
*/
ef5584
CREATE TABLE phpbb_acl_roles_data (
ef5584
	role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0),
ef5584
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
ef5584
	auth_setting INT2 DEFAULT '0' NOT NULL,
ef5584
	PRIMARY KEY (role_id, auth_option_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_acl_users'
ef5584
*/
ef5584
CREATE TABLE phpbb_acl_users (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0),
ef5584
	auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0),
ef5584
	auth_setting INT2 DEFAULT '0' NOT NULL
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
ef5584
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
ef5584
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_banlist'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_banlist_seq;
ef5584
ef5584
CREATE TABLE phpbb_banlist (
ef5584
	ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'),
ef5584
	ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0),
ef5584
	ban_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	ban_email varchar(100) DEFAULT '' NOT NULL,
ef5584
	ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0),
ef5584
	ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0),
ef5584
	ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0),
ef5584
	ban_reason varchar(255) DEFAULT '' NOT NULL,
ef5584
	ban_give_reason varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (ban_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end);
ef5584
CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude);
ef5584
CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude);
ef5584
CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_bbcodes'
ef5584
*/
ef5584
CREATE TABLE phpbb_bbcodes (
ef5584
	bbcode_id INT2 DEFAULT '0' NOT NULL,
ef5584
	bbcode_tag varchar(16) DEFAULT '' NOT NULL,
ef5584
	bbcode_helpline varchar(255) DEFAULT '' NOT NULL,
ef5584
	display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0),
ef5584
	bbcode_match varchar(4000) DEFAULT '' NOT NULL,
ef5584
	bbcode_tpl TEXT DEFAULT '' NOT NULL,
ef5584
	first_pass_match TEXT DEFAULT '' NOT NULL,
ef5584
	first_pass_replace TEXT DEFAULT '' NOT NULL,
ef5584
	second_pass_match TEXT DEFAULT '' NOT NULL,
ef5584
	second_pass_replace TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (bbcode_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_bookmarks'
ef5584
*/
ef5584
CREATE TABLE phpbb_bookmarks (
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	PRIMARY KEY (topic_id, user_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_bots'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_bots_seq;
ef5584
ef5584
CREATE TABLE phpbb_bots (
ef5584
	bot_id INT4 DEFAULT nextval('phpbb_bots_seq'),
ef5584
	bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0),
ef5584
	bot_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	bot_agent varchar(255) DEFAULT '' NOT NULL,
ef5584
	bot_ip varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (bot_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_config'
ef5584
*/
ef5584
CREATE TABLE phpbb_config (
ef5584
	config_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	config_value varchar(255) DEFAULT '' NOT NULL,
ef5584
	is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0),
ef5584
	PRIMARY KEY (config_name)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_confirm'
ef5584
*/
ef5584
CREATE TABLE phpbb_confirm (
ef5584
	confirm_id char(32) DEFAULT '' NOT NULL,
ef5584
	session_id char(32) DEFAULT '' NOT NULL,
ef5584
	confirm_type INT2 DEFAULT '0' NOT NULL,
ef5584
	code varchar(8) DEFAULT '' NOT NULL,
ef5584
	seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0),
ef5584
	PRIMARY KEY (session_id, confirm_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_disallow'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_disallow_seq;
ef5584
ef5584
CREATE TABLE phpbb_disallow (
ef5584
	disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'),
ef5584
	disallow_username varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (disallow_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_drafts'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_drafts_seq;
ef5584
ef5584
CREATE TABLE phpbb_drafts (
ef5584
	draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0),
ef5584
	draft_subject varchar(255) DEFAULT '' NOT NULL,
ef5584
	draft_message TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (draft_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_extensions'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_extensions_seq;
ef5584
ef5584
CREATE TABLE phpbb_extensions (
ef5584
	extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'),
ef5584
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
ef5584
	extension varchar(100) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (extension_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_extension_groups'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_extension_groups_seq;
ef5584
ef5584
CREATE TABLE phpbb_extension_groups (
ef5584
	group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'),
ef5584
	group_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	cat_id INT2 DEFAULT '0' NOT NULL,
ef5584
	allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0),
ef5584
	download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0),
ef5584
	upload_icon varchar(255) DEFAULT '' NOT NULL,
ef5584
	max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0),
ef5584
	allowed_forums varchar(8000) DEFAULT '' NOT NULL,
ef5584
	allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0),
ef5584
	PRIMARY KEY (group_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_forums'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_forums_seq;
ef5584
ef5584
CREATE TABLE phpbb_forums (
ef5584
	forum_id INT4 DEFAULT nextval('phpbb_forums_seq'),
ef5584
	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
ef5584
	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
ef5584
	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
ef5584
	forum_parents TEXT DEFAULT '' NOT NULL,
ef5584
	forum_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_desc varchar(4000) DEFAULT '' NOT NULL,
ef5584
	forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0),
ef5584
	forum_desc_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	forum_link varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_password varchar(40) DEFAULT '' NOT NULL,
ef5584
	forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0),
ef5584
	forum_image varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_rules varchar(4000) DEFAULT '' NOT NULL,
ef5584
	forum_rules_link varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0),
ef5584
	forum_rules_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
ef5584
	forum_type INT2 DEFAULT '0' NOT NULL,
ef5584
	forum_status INT2 DEFAULT '0' NOT NULL,
ef5584
	forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
ef5584
	forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
ef5584
	forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
ef5584
	forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
ef5584
	forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
ef5584
	forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0),
ef5584
	forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
ef5584
	forum_flags INT2 DEFAULT '32' NOT NULL,
ef5584
	display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
ef5584
	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
ef5584
	enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
ef5584
	enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
ef5584
	enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
ef5584
	prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0),
ef5584
	prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0),
ef5584
	prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0),
ef5584
	prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0),
ef5584
	PRIMARY KEY (forum_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id);
ef5584
CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_forums_access'
ef5584
*/
ef5584
CREATE TABLE phpbb_forums_access (
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	session_id char(32) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (forum_id, user_id, session_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_forums_track'
ef5584
*/
ef5584
CREATE TABLE phpbb_forums_track (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
ef5584
	PRIMARY KEY (user_id, forum_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_forums_watch'
ef5584
*/
ef5584
CREATE TABLE phpbb_forums_watch (
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id);
ef5584
CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id);
ef5584
CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_groups'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_groups_seq;
ef5584
ef5584
CREATE TABLE phpbb_groups (
ef5584
	group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
ef5584
	group_type INT2 DEFAULT '1' NOT NULL,
ef5584
	group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
ef5584
	group_name varchar_ci DEFAULT '' NOT NULL,
ef5584
	group_desc varchar(4000) DEFAULT '' NOT NULL,
ef5584
	group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0),
ef5584
	group_desc_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0),
ef5584
	group_avatar varchar(255) DEFAULT '' NOT NULL,
ef5584
	group_avatar_type INT2 DEFAULT '0' NOT NULL,
ef5584
	group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0),
ef5584
	group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0),
ef5584
	group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0),
ef5584
	group_colour varchar(6) DEFAULT '' NOT NULL,
ef5584
	group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
ef5584
	group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
ef5584
	group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
ef5584
	group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
ef5584
	group_legend INT2 DEFAULT '1' NOT NULL CHECK (group_legend >= 0),
ef5584
	PRIMARY KEY (group_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_icons'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_icons_seq;
ef5584
ef5584
CREATE TABLE phpbb_icons (
ef5584
	icons_id INT4 DEFAULT nextval('phpbb_icons_seq'),
ef5584
	icons_url varchar(255) DEFAULT '' NOT NULL,
ef5584
	icons_width INT2 DEFAULT '0' NOT NULL,
ef5584
	icons_height INT2 DEFAULT '0' NOT NULL,
ef5584
	icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0),
ef5584
	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
ef5584
	PRIMARY KEY (icons_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_lang'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_lang_seq;
ef5584
ef5584
CREATE TABLE phpbb_lang (
ef5584
	lang_id INT2 DEFAULT nextval('phpbb_lang_seq'),
ef5584
	lang_iso varchar(30) DEFAULT '' NOT NULL,
ef5584
	lang_dir varchar(30) DEFAULT '' NOT NULL,
ef5584
	lang_english_name varchar(100) DEFAULT '' NOT NULL,
ef5584
	lang_local_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	lang_author varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (lang_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_log'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_log_seq;
ef5584
ef5584
CREATE TABLE phpbb_log (
ef5584
	log_id INT4 DEFAULT nextval('phpbb_log_seq'),
ef5584
	log_type INT2 DEFAULT '0' NOT NULL,
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0),
ef5584
	log_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0),
ef5584
	log_operation varchar(4000) DEFAULT '' NOT NULL,
ef5584
	log_data TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (log_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);
ef5584
CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id);
ef5584
CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id);
ef5584
CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id);
ef5584
CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_moderator_cache'
ef5584
*/
ef5584
CREATE TABLE phpbb_moderator_cache (
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	username varchar(255) DEFAULT '' NOT NULL,
ef5584
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
ef5584
	group_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index);
ef5584
CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_modules'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_modules_seq;
ef5584
ef5584
CREATE TABLE phpbb_modules (
ef5584
	module_id INT4 DEFAULT nextval('phpbb_modules_seq'),
ef5584
	module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0),
ef5584
	module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0),
ef5584
	module_basename varchar(255) DEFAULT '' NOT NULL,
ef5584
	module_class varchar(10) DEFAULT '' NOT NULL,
ef5584
	parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0),
ef5584
	left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0),
ef5584
	right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0),
ef5584
	module_langname varchar(255) DEFAULT '' NOT NULL,
ef5584
	module_mode varchar(255) DEFAULT '' NOT NULL,
ef5584
	module_auth varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (module_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id);
ef5584
CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled);
ef5584
CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_poll_options'
ef5584
*/
ef5584
CREATE TABLE phpbb_poll_options (
ef5584
	poll_option_id INT2 DEFAULT '0' NOT NULL,
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	poll_option_text varchar(4000) DEFAULT '' NOT NULL,
ef5584
	poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id);
ef5584
CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_poll_votes'
ef5584
*/
ef5584
CREATE TABLE phpbb_poll_votes (
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	poll_option_id INT2 DEFAULT '0' NOT NULL,
ef5584
	vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0),
ef5584
	vote_user_ip varchar(40) DEFAULT '' NOT NULL
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id);
ef5584
CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id);
ef5584
CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_posts'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_posts_seq;
ef5584
ef5584
CREATE TABLE phpbb_posts (
ef5584
	post_id INT4 DEFAULT nextval('phpbb_posts_seq'),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0),
ef5584
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
ef5584
	poster_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
ef5584
	post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
ef5584
	post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
ef5584
	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
ef5584
	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
ef5584
	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
ef5584
	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
ef5584
	post_username varchar(255) DEFAULT '' NOT NULL,
ef5584
	post_subject varchar(255) DEFAULT '' NOT NULL,
ef5584
	post_text TEXT DEFAULT '' NOT NULL,
ef5584
	post_checksum varchar(32) DEFAULT '' NOT NULL,
ef5584
	post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0),
ef5584
	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0),
ef5584
	post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0),
ef5584
	post_edit_reason varchar(255) DEFAULT '' NOT NULL,
ef5584
	post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
ef5584
	post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
ef5584
	post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
ef5584
	PRIMARY KEY (post_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id);
ef5584
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id);
ef5584
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip);
ef5584
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id);
ef5584
CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved);
ef5584
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_privmsgs'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_privmsgs_seq;
ef5584
ef5584
CREATE TABLE phpbb_privmsgs (
ef5584
	msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'),
ef5584
	root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0),
ef5584
	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
ef5584
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
ef5584
	author_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0),
ef5584
	enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
ef5584
	enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
ef5584
	enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0),
ef5584
	enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0),
ef5584
	message_subject varchar(255) DEFAULT '' NOT NULL,
ef5584
	message_text TEXT DEFAULT '' NOT NULL,
ef5584
	message_edit_reason varchar(255) DEFAULT '' NOT NULL,
ef5584
	message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0),
ef5584
	message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0),
ef5584
	bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	bbcode_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0),
ef5584
	message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
ef5584
	to_address varchar(4000) DEFAULT '' NOT NULL,
ef5584
	bcc_address varchar(4000) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (msg_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip);
ef5584
CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time);
ef5584
CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id);
ef5584
CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_privmsgs_folder'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_privmsgs_folder_seq;
ef5584
ef5584
CREATE TABLE phpbb_privmsgs_folder (
ef5584
	folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	folder_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0),
ef5584
	PRIMARY KEY (folder_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_privmsgs_rules'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_privmsgs_rules_seq;
ef5584
ef5584
CREATE TABLE phpbb_privmsgs_rules (
ef5584
	rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0),
ef5584
	rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0),
ef5584
	rule_string varchar(255) DEFAULT '' NOT NULL,
ef5584
	rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
ef5584
	rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
ef5584
	rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
ef5584
	rule_folder_id INT4 DEFAULT '0' NOT NULL,
ef5584
	PRIMARY KEY (rule_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_privmsgs_to'
ef5584
*/
ef5584
CREATE TABLE phpbb_privmsgs_to (
ef5584
	msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0),
ef5584
	pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0),
ef5584
	pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0),
ef5584
	pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0),
ef5584
	pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
ef5584
	pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
ef5584
	pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
ef5584
	folder_id INT4 DEFAULT '0' NOT NULL
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id);
ef5584
CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id);
ef5584
CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_profile_fields'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_profile_fields_seq;
ef5584
ef5584
CREATE TABLE phpbb_profile_fields (
ef5584
	field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
ef5584
	field_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	field_type INT2 DEFAULT '0' NOT NULL,
ef5584
	field_ident varchar(20) DEFAULT '' NOT NULL,
ef5584
	field_length varchar(20) DEFAULT '' NOT NULL,
ef5584
	field_minlen varchar(255) DEFAULT '' NOT NULL,
ef5584
	field_maxlen varchar(255) DEFAULT '' NOT NULL,
ef5584
	field_novalue varchar(255) DEFAULT '' NOT NULL,
ef5584
	field_default_value varchar(255) DEFAULT '' NOT NULL,
ef5584
	field_validation varchar(20) DEFAULT '' NOT NULL,
ef5584
	field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
ef5584
	field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
ef5584
	field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
ef5584
	field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
ef5584
	field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
ef5584
	field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
ef5584
	field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0),
ef5584
	PRIMARY KEY (field_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type);
ef5584
CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_profile_fields_data'
ef5584
*/
ef5584
CREATE TABLE phpbb_profile_fields_data (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	PRIMARY KEY (user_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_profile_fields_lang'
ef5584
*/
ef5584
CREATE TABLE phpbb_profile_fields_lang (
ef5584
	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
ef5584
	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
ef5584
	option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0),
ef5584
	field_type INT2 DEFAULT '0' NOT NULL,
ef5584
	lang_value varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (field_id, lang_id, option_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_profile_lang'
ef5584
*/
ef5584
CREATE TABLE phpbb_profile_lang (
ef5584
	field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0),
ef5584
	lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0),
ef5584
	lang_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	lang_explain varchar(4000) DEFAULT '' NOT NULL,
ef5584
	lang_default_value varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (field_id, lang_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_ranks'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_ranks_seq;
ef5584
ef5584
CREATE TABLE phpbb_ranks (
ef5584
	rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'),
ef5584
	rank_title varchar(255) DEFAULT '' NOT NULL,
ef5584
	rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0),
ef5584
	rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0),
ef5584
	rank_image varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (rank_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_reports'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_reports_seq;
ef5584
ef5584
CREATE TABLE phpbb_reports (
ef5584
	report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
ef5584
	reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
ef5584
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
ef5584
	report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
ef5584
	report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
ef5584
	report_text TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (report_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_reports_reasons'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_reports_reasons_seq;
ef5584
ef5584
CREATE TABLE phpbb_reports_reasons (
ef5584
	reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'),
ef5584
	reason_title varchar(255) DEFAULT '' NOT NULL,
ef5584
	reason_description TEXT DEFAULT '' NOT NULL,
ef5584
	reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0),
ef5584
	PRIMARY KEY (reason_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_search_results'
ef5584
*/
ef5584
CREATE TABLE phpbb_search_results (
ef5584
	search_key varchar(32) DEFAULT '' NOT NULL,
ef5584
	search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0),
ef5584
	search_keywords TEXT DEFAULT '' NOT NULL,
ef5584
	search_authors TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (search_key)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_search_wordlist'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_search_wordlist_seq;
ef5584
ef5584
CREATE TABLE phpbb_search_wordlist (
ef5584
	word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
ef5584
	word_text varchar(255) DEFAULT '' NOT NULL,
ef5584
	word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
ef5584
	word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
ef5584
	PRIMARY KEY (word_id)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
ef5584
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_search_wordmatch'
ef5584
*/
ef5584
CREATE TABLE phpbb_search_wordmatch (
ef5584
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
ef5584
	word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0),
ef5584
	title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match);
ef5584
CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id);
ef5584
CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_sessions'
ef5584
*/
ef5584
CREATE TABLE phpbb_sessions (
ef5584
	session_id char(32) DEFAULT '' NOT NULL,
ef5584
	session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0),
ef5584
	session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0),
ef5584
	session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0),
ef5584
	session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0),
ef5584
	session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0),
ef5584
	session_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	session_browser varchar(150) DEFAULT '' NOT NULL,
ef5584
	session_forwarded_for varchar(255) DEFAULT '' NOT NULL,
ef5584
	session_page varchar(255) DEFAULT '' NOT NULL,
ef5584
	session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0),
ef5584
	session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0),
ef5584
	session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0),
ef5584
	PRIMARY KEY (session_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time);
ef5584
CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id);
ef5584
CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_sessions_keys'
ef5584
*/
ef5584
CREATE TABLE phpbb_sessions_keys (
ef5584
	key_id char(32) DEFAULT '' NOT NULL,
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	last_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0),
ef5584
	PRIMARY KEY (key_id, user_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_sitelist'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_sitelist_seq;
ef5584
ef5584
CREATE TABLE phpbb_sitelist (
ef5584
	site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'),
ef5584
	site_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	site_hostname varchar(255) DEFAULT '' NOT NULL,
ef5584
	ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0),
ef5584
	PRIMARY KEY (site_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_smilies'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_smilies_seq;
ef5584
ef5584
CREATE TABLE phpbb_smilies (
ef5584
	smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'),
ef5584
	code varchar(50) DEFAULT '' NOT NULL,
ef5584
	emotion varchar(50) DEFAULT '' NOT NULL,
ef5584
	smiley_url varchar(50) DEFAULT '' NOT NULL,
ef5584
	smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0),
ef5584
	smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0),
ef5584
	smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0),
ef5584
	display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0),
ef5584
	PRIMARY KEY (smiley_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_styles_seq;
ef5584
ef5584
CREATE TABLE phpbb_styles (
ef5584
	style_id INT4 DEFAULT nextval('phpbb_styles_seq'),
ef5584
	style_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	style_copyright varchar(255) DEFAULT '' NOT NULL,
ef5584
	style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0),
ef5584
	template_id INT4 DEFAULT '0' NOT NULL CHECK (template_id >= 0),
ef5584
	theme_id INT4 DEFAULT '0' NOT NULL CHECK (theme_id >= 0),
ef5584
	imageset_id INT4 DEFAULT '0' NOT NULL CHECK (imageset_id >= 0),
ef5584
	PRIMARY KEY (style_id)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);
ef5584
CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id);
ef5584
CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id);
ef5584
CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles_template'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_styles_template_seq;
ef5584
ef5584
CREATE TABLE phpbb_styles_template (
ef5584
	template_id INT4 DEFAULT nextval('phpbb_styles_template_seq'),
ef5584
	template_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	template_copyright varchar(255) DEFAULT '' NOT NULL,
ef5584
	template_path varchar(100) DEFAULT '' NOT NULL,
ef5584
	bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
ef5584
	template_storedb INT2 DEFAULT '0' NOT NULL CHECK (template_storedb >= 0),
ef5584
	template_inherits_id INT4 DEFAULT '0' NOT NULL CHECK (template_inherits_id >= 0),
ef5584
	template_inherit_path varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (template_id)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (template_name);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles_template_data'
ef5584
*/
ef5584
CREATE TABLE phpbb_styles_template_data (
ef5584
	template_id INT4 DEFAULT '0' NOT NULL CHECK (template_id >= 0),
ef5584
	template_filename varchar(100) DEFAULT '' NOT NULL,
ef5584
	template_included varchar(8000) DEFAULT '' NOT NULL,
ef5584
	template_mtime INT4 DEFAULT '0' NOT NULL CHECK (template_mtime >= 0),
ef5584
	template_data TEXT DEFAULT '' NOT NULL
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id);
ef5584
CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles_theme'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_styles_theme_seq;
ef5584
ef5584
CREATE TABLE phpbb_styles_theme (
ef5584
	theme_id INT4 DEFAULT nextval('phpbb_styles_theme_seq'),
ef5584
	theme_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	theme_copyright varchar(255) DEFAULT '' NOT NULL,
ef5584
	theme_path varchar(100) DEFAULT '' NOT NULL,
ef5584
	theme_storedb INT2 DEFAULT '0' NOT NULL CHECK (theme_storedb >= 0),
ef5584
	theme_mtime INT4 DEFAULT '0' NOT NULL CHECK (theme_mtime >= 0),
ef5584
	theme_data TEXT DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (theme_id)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles_imageset'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_styles_imageset_seq;
ef5584
ef5584
CREATE TABLE phpbb_styles_imageset (
ef5584
	imageset_id INT4 DEFAULT nextval('phpbb_styles_imageset_seq'),
ef5584
	imageset_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	imageset_copyright varchar(255) DEFAULT '' NOT NULL,
ef5584
	imageset_path varchar(100) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (imageset_id)
ef5584
);
ef5584
ef5584
CREATE UNIQUE INDEX phpbb_styles_imageset_imgset_nm ON phpbb_styles_imageset (imageset_name);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_styles_imageset_data'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_styles_imageset_data_seq;
ef5584
ef5584
CREATE TABLE phpbb_styles_imageset_data (
ef5584
	image_id INT4 DEFAULT nextval('phpbb_styles_imageset_data_seq'),
ef5584
	image_name varchar(200) DEFAULT '' NOT NULL,
ef5584
	image_filename varchar(200) DEFAULT '' NOT NULL,
ef5584
	image_lang varchar(30) DEFAULT '' NOT NULL,
ef5584
	image_height INT2 DEFAULT '0' NOT NULL CHECK (image_height >= 0),
ef5584
	image_width INT2 DEFAULT '0' NOT NULL CHECK (image_width >= 0),
ef5584
	imageset_id INT4 DEFAULT '0' NOT NULL CHECK (imageset_id >= 0),
ef5584
	PRIMARY KEY (image_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_styles_imageset_data_i_d ON phpbb_styles_imageset_data (imageset_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_topics'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_topics_seq;
ef5584
ef5584
CREATE TABLE phpbb_topics (
ef5584
	topic_id INT4 DEFAULT nextval('phpbb_topics_seq'),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
ef5584
	topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
ef5584
	topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
ef5584
	topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
ef5584
	topic_title varchar(255) DEFAULT '' NOT NULL,
ef5584
	topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
ef5584
	topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
ef5584
	topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
ef5584
	topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
ef5584
	topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
ef5584
	topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
ef5584
	topic_status INT2 DEFAULT '0' NOT NULL,
ef5584
	topic_type INT2 DEFAULT '0' NOT NULL,
ef5584
	topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
ef5584
	topic_first_poster_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL,
ef5584
	topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0),
ef5584
	topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0),
ef5584
	topic_last_poster_name varchar(255) DEFAULT '' NOT NULL,
ef5584
	topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
ef5584
	topic_last_post_subject varchar(255) DEFAULT '' NOT NULL,
ef5584
	topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0),
ef5584
	topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0),
ef5584
	topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
ef5584
	topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
ef5584
	topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
ef5584
	poll_title varchar(255) DEFAULT '' NOT NULL,
ef5584
	poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
ef5584
	poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
ef5584
	poll_max_options INT2 DEFAULT '1' NOT NULL,
ef5584
	poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
ef5584
	poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
ef5584
	PRIMARY KEY (topic_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id);
ef5584
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type);
ef5584
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time);
ef5584
CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved);
ef5584
CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id);
ef5584
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_topics_track'
ef5584
*/
ef5584
CREATE TABLE phpbb_topics_track (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
ef5584
	mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0),
ef5584
	PRIMARY KEY (user_id, topic_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_topics_posted'
ef5584
*/
ef5584
CREATE TABLE phpbb_topics_posted (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0),
ef5584
	PRIMARY KEY (user_id, topic_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_topics_watch'
ef5584
*/
ef5584
CREATE TABLE phpbb_topics_watch (
ef5584
	topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id);
ef5584
CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id);
ef5584
CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_user_group'
ef5584
*/
ef5584
CREATE TABLE phpbb_user_group (
ef5584
	group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0),
ef5584
	user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id);
ef5584
CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id);
ef5584
CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_users'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_users_seq;
ef5584
ef5584
CREATE TABLE phpbb_users (
ef5584
	user_id INT4 DEFAULT nextval('phpbb_users_seq'),
ef5584
	user_type INT2 DEFAULT '0' NOT NULL,
ef5584
	group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0),
ef5584
	user_permissions TEXT DEFAULT '' NOT NULL,
ef5584
	user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0),
ef5584
	user_ip varchar(40) DEFAULT '' NOT NULL,
ef5584
	user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
ef5584
	username varchar_ci DEFAULT '' NOT NULL,
ef5584
	username_clean varchar_ci DEFAULT '' NOT NULL,
ef5584
	user_password varchar(40) DEFAULT '' NOT NULL,
ef5584
	user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
ef5584
	user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
ef5584
	user_email varchar(100) DEFAULT '' NOT NULL,
ef5584
	user_email_hash INT8 DEFAULT '0' NOT NULL,
ef5584
	user_birthday varchar(10) DEFAULT '' NOT NULL,
ef5584
	user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0),
ef5584
	user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0),
ef5584
	user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0),
ef5584
	user_lastpage varchar(200) DEFAULT '' NOT NULL,
ef5584
	user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
ef5584
	user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0),
ef5584
	user_warnings INT2 DEFAULT '0' NOT NULL,
ef5584
	user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0),
ef5584
	user_login_attempts INT2 DEFAULT '0' NOT NULL,
ef5584
	user_inactive_reason INT2 DEFAULT '0' NOT NULL,
ef5584
	user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0),
ef5584
	user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0),
ef5584
	user_lang varchar(30) DEFAULT '' NOT NULL,
ef5584
	user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
ef5584
	user_dst INT2 DEFAULT '0' NOT NULL CHECK (user_dst >= 0),
ef5584
	user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL,
ef5584
	user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0),
ef5584
	user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0),
ef5584
	user_colour varchar(6) DEFAULT '' NOT NULL,
ef5584
	user_new_privmsg INT4 DEFAULT '0' NOT NULL,
ef5584
	user_unread_privmsg INT4 DEFAULT '0' NOT NULL,
ef5584
	user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0),
ef5584
	user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0),
ef5584
	user_full_folder INT4 DEFAULT '-3' NOT NULL,
ef5584
	user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0),
ef5584
	user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0),
ef5584
	user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL,
ef5584
	user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL,
ef5584
	user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0),
ef5584
	user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL,
ef5584
	user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL,
ef5584
	user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
ef5584
	user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0),
ef5584
	user_notify_type INT2 DEFAULT '0' NOT NULL,
ef5584
	user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0),
ef5584
	user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
ef5584
	user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
ef5584
	user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
ef5584
	user_options INT4 DEFAULT '895' NOT NULL CHECK (user_options >= 0),
ef5584
	user_avatar varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_avatar_type INT2 DEFAULT '0' NOT NULL,
ef5584
	user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),
ef5584
	user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0),
ef5584
	user_sig TEXT DEFAULT '' NOT NULL,
ef5584
	user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
ef5584
	user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_from varchar(100) DEFAULT '' NOT NULL,
ef5584
	user_icq varchar(15) DEFAULT '' NOT NULL,
ef5584
	user_aim varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_yim varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_msnm varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_jabber varchar(255) DEFAULT '' NOT NULL,
ef5584
	user_website varchar(200) DEFAULT '' NOT NULL,
ef5584
	user_occ varchar(4000) DEFAULT '' NOT NULL,
ef5584
	user_interests varchar(4000) DEFAULT '' NOT NULL,
ef5584
	user_actkey varchar(32) DEFAULT '' NOT NULL,
ef5584
	user_newpasswd varchar(40) DEFAULT '' NOT NULL,
ef5584
	user_form_salt varchar(32) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (user_id)
ef5584
);
ef5584
ef5584
CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday);
ef5584
CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash);
ef5584
CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type);
ef5584
CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean);
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_warnings'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_warnings_seq;
ef5584
ef5584
CREATE TABLE phpbb_warnings (
ef5584
	warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'),
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
ef5584
	log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0),
ef5584
	warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0),
ef5584
	PRIMARY KEY (warning_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_words'
ef5584
*/
ef5584
CREATE SEQUENCE phpbb_words_seq;
ef5584
ef5584
CREATE TABLE phpbb_words (
ef5584
	word_id INT4 DEFAULT nextval('phpbb_words_seq'),
ef5584
	word varchar(255) DEFAULT '' NOT NULL,
ef5584
	replacement varchar(255) DEFAULT '' NOT NULL,
ef5584
	PRIMARY KEY (word_id)
ef5584
);
ef5584
ef5584
ef5584
/*
ef5584
	Table: 'phpbb_zebra'
ef5584
*/
ef5584
CREATE TABLE phpbb_zebra (
ef5584
	user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
ef5584
	zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0),
ef5584
	friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0),
ef5584
	foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0),
ef5584
	PRIMARY KEY (user_id, zebra_id)
ef5584
);
ef5584
ef5584
ef5584
ef5584
COMMIT;