[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/install/schemas/ -> postgres_schema.sql (source)

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


Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1