diff options
-rw-r--r-- | phpBB/develop/create_schema_files.php | 74 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_database.php | 174 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 36 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 3 | ||||
-rw-r--r-- | phpBB/includes/db/db2.php | 496 | ||||
-rw-r--r-- | phpBB/includes/db/db_tools.php | 95 | ||||
-rw-r--r-- | phpBB/includes/functions_install.php | 22 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 4 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 2 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 27 | ||||
-rwxr-xr-x | phpBB/install/install_install.php | 6 | ||||
-rw-r--r-- | phpBB/install/schemas/db2_schema.sql | 1122 | ||||
-rwxr-xr-x | phpBB/language/en/install.php | 2 |
13 files changed, 2049 insertions, 14 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 8d6ed4e51f..f364030231 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -12,7 +12,7 @@ * If you overwrite the original schema files please make sure you save the file with UNIX linefeeds. */ -die("Please read the first lines of this script for instructions on how to enable it"); +//die("Please read the first lines of this script for instructions on how to enable it"); @set_time_limit(0); @@ -115,6 +115,33 @@ $dbms_type_map = array( 'VARBINARY' => '[varchar] (255)', ), + 'db2' => array( + 'INT:' => 'integer', + 'BINT' => 'float', + 'UINT' => 'integer', + 'UINT:' => 'integer', + 'TINT:' => 'smallint', + 'USINT' => 'smallint', + 'BOOL' => 'smallint', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'clob(65K)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'clob(65K)', + 'MTEXT' => 'clob(16M)', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'clob(65K)', + 'MTEXT_UNI' => 'clob(16M)', + 'TIMESTAMP' => 'integer', + 'DECIMAL' => 'float', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varchar(255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -208,11 +235,11 @@ $dbms_type_map = array( // A list of types being unsigned for better reference in some db's $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); -$supported_dbms = array('firebird', 'mssql', 'mysql', 'oracle', 'postgres', 'sqlite'); +$supported_dbms = array('firebird', 'mssql', 'mysql', 'db2', 'oracle', 'postgres', 'sqlite'); foreach ($supported_dbms as $dbms) { - $fp = fopen($schema_path . '_' . $dbms . '_schema.sql', 'wt'); + $fp = fopen($schema_path . '' . $dbms . '_schema.sql', 'wt'); $line = ''; @@ -238,6 +265,10 @@ foreach ($supported_dbms as $dbms) $line .= "BEGIN TRANSACTION\nGO\n\n"; break; + case 'db2': + $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; + break; + case 'oracle': $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; $line .= custom_data('oracle') . "\n"; @@ -266,6 +297,7 @@ foreach ($supported_dbms as $dbms) case 'mssql': case 'oracle': case 'postgres': + case 'db2': fwrite($fp, "/*\n\tTable: '{$table_name}'\n*/\n"); break; } @@ -281,6 +313,7 @@ foreach ($supported_dbms as $dbms) case 'oracle': case 'sqlite': case 'postgres': + case 'db2': $line = "CREATE TABLE {$table_name} (\n"; break; @@ -489,6 +522,27 @@ foreach ($supported_dbms as $dbms) $line .= ",\n"; } break; + + case 'db2': + $line .= "\t{$column_name} {$column_type} NOT NULL"; + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $line .= ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)'; + } + else + { + if (preg_match('/^(integer|smallint|float)$/', $column_type)) + { + $line .= " DEFAULT {$column_data[1]}"; + } + else + { + $line .= " DEFAULT '{$column_data[1]}'"; + } + } + $line .= ",\n"; + break; } } @@ -519,6 +573,7 @@ foreach ($supported_dbms as $dbms) { case 'mysql': case 'postgres': + case 'db2': $line .= "\tPRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; break; @@ -579,6 +634,12 @@ foreach ($supported_dbms as $dbms) $line .= "\n);\n\n"; break; + case 'db2': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n);\n\n"; + break; + case 'sqlite': // Remove last line delimiter... $line = substr($line, 0, -2); @@ -656,6 +717,13 @@ foreach ($supported_dbms as $dbms) $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");\n"; break; + + case 'db2': + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; + + $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ") PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS;\n"; + break; } } } diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index d7ce8db8b3..64806eda59 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -113,6 +113,10 @@ class acp_database case 'firebird': $extractor = new firebird_extractor($download, $store, $format, $filename, $time); break; + + case 'db2': + $extractor = new db2_extractor($download, $store, $format, $filename, $time); + break; } $extractor->write_start($table_prefix); @@ -131,6 +135,7 @@ class acp_database { case 'sqlite': case 'firebird': + case 'db2': $extractor->flush('DELETE FROM ' . $table_name . ";\n"); break; @@ -1552,6 +1557,175 @@ class mssql_extractor extends base_extractor /** * @package acp */ +class db2_extractor extends base_extractor +{ + function write_start($prefix) + { + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $this->flush($sql_data); + } + + function write_table($table_name) + { + global $db; + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "\nCREATE TABLE $table_name (\n"; + $rows = array(); + + // switch to db2_columns()? + $sql = "SELECT colname, typename, length, default, identity, nulls + FROM syscat.columns + WHERE tabname = '$table_name'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $line = "\t{$row['colname']} {$row['typename']}"; + + if ($row['identity'] == 'Y') + { + $line .= ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)'; + } + + if ($row['typename'] == 'VARCHAR' || $row['typename'] == 'CHARACTER' || $row['typename'] == 'CLOB') + { + $line .= ' (' . $row['length'] . ')'; + } + + if ($row['nulls'] == 'N') + { + $line .= ' NOT NULL'; + } + else + { + $line .= ' NULL'; + } + + if ($row['default'] !== null) + { + $line .= ' DEFAULT ' . $row['default']; + } + + $rows[] = $line; + } + $db->sql_freeresult($result); + + // switch to db2_columns()? + $sql = "SELECT colname + FROM SYSCAT.KEYCOLUSE + WHERE tabname = '$table_name'"; + $result = $db->sql_query($sql); + $prim_cols = array(); + while ($row = $db->sql_fetchrow($result)) + { + $prim_cols[] = $row['colname']; + } + $db->sql_freeresult($result); + if (sizeof($prim_cols)) + { + $rows[] = "\tPRIMARY KEY (" . implode($prim_cols) . ')'; + } + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n);\n\n"; + $rows = array(); + + $sql = "SELECT colnames, indname + FROM SYSCAT.INDEXES + WHERE TABNAME = '$table_name' + AND UNIQUERULE <> 'P'"; + $result = $db->sql_query($sql); + $index = array(); + while ($row = $db->sql_fetchrow($result)) + { + $inds = explode('+', $row['colnames']); + unset($inds[0]); + $sql_data .= 'CREATE INDEX ' . $row['indname'] . ' ON ' . $table_name . ' (' . implode(', ', $inds) . ") PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS;\n"; + } + $db->sql_freeresult($result); + + $this->flush($sql_data); + } + + function write_data($table_name) + { + global $db; + $ary_type = $ary_name = array(); + $result = db2_columns($db->db_connect_id, '', '%', $table_name); + $i = 0; + while ($row = $db->sql_fetchrow($result)) + { + $ary_type[$i] = $row['type_name']; + $ary_name[$i++] = strtolower($row['column_name']); + } + $db->sql_freeresult($result); + + // Grab all of the data from current table. + $sql = "SELECT * + FROM $table_name"; + $result = $db->sql_query($sql); + + $sql_data = ''; + $i_num_fields = $i; + + while ($row = $db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|clob#i', $ary_type[$i])) + { + $str_quote = "'"; + $str_empty = ''; + $str_val = sanitize_data_generic(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0') + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = '"' . $ary_name[$i] . "'"; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n"; + + $this->flush($sql_data); + } + $db->sql_freeresult($result); + } +} + +/** +* @package acp +*/ class oracle_extractor extends base_extractor { function write_table($table_name) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 2a9c0e8c19..bd7d58717b 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -1605,6 +1605,42 @@ class acp_profile } break; + + case 'db2': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" "; + + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR(10) '; + break; + + case FIELD_TEXT: + $sql .= "varchar(32672)"; + // ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED"; + break; + + case FIELD_BOOL: + $sql .= 'smallint '; + break; + + case FIELD_DROPDOWN: + $sql .= 'integer '; + break; + + case FIELD_INT: + $sql .= 'float '; + break; + } + + break; } return $sql; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index f87e175301..13612cf363 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -775,7 +775,7 @@ class acp_users { $sql_ary += array( 'user_email' => $update_email, - 'user_email_hash' => crc32($update_email) . strlen($update_email) + 'user_email_hash' => hexdec(crc32($update_email) . strlen($update_email)) ); add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); @@ -1130,6 +1130,7 @@ class acp_users case 'oracle': case 'firebird': case 'postgres': + case 'db2': $right_delim = $left_delim = '"'; break; diff --git a/phpBB/includes/db/db2.php b/phpBB/includes/db/db2.php new file mode 100644 index 0000000000..d1917e6c3a --- /dev/null +++ b/phpBB/includes/db/db2.php @@ -0,0 +1,496 @@ +<?php +/** +* +* @package dbal +* @version $Id$ +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); + +/** +* MSSQL Database Abstraction Layer +* Minimum Requirement is DB2 8.2.2 +* @package dbal +*/ +class dbal_db2 extends dbal +{ + var $multi_insert = true; + var $last_query_text = ''; + + // can't truncate a table + var $truncate = false; + + /** + * Connect to server + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = $persistency; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + $this->db_connect_id = ($this->persistency) ? @db2_pconnect($this->dbname, $this->user, $sqlpassword, array('autocommit' => DB2_AUTOCOMMIT_ON, 'DB2_ATTR_CASE' => DB2_CASE_LOWER)) : @db2_connect($this->dbname, $this->user, $sqlpassword, array('autocommit' => DB2_AUTOCOMMIT_ON, 'DB2_ATTR_CASE' => DB2_CASE_LOWER)); + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * Version information about used database + */ + function sql_server_info() + { + $info = db2_server_info($this->db_connect_id); + return $info->DBMS_VER; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @db2_autocommit($this->db_connect_id, DB2_AUTOCOMMIT_OFF); + break; + + case 'commit': + $result = @db2_commit($this->db_connect_id); + @db2_autocommit($this->db_connect_id, DB2_AUTOCOMMIT_ON); + return $result; + break; + + case 'rollback': + $result = @db2_rollback($this->db_connect_id); + @db2_autocommit($this->db_connect_id, DB2_AUTOCOMMIT_ON); + return $result; + break; + } + + return true; + } + + /** + * Base query method + * + * @param string $query Contains the SQL query which shall be executed + * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache + * @return mixed When casted to bool the returned value returns true on success and false on failure + * + * @access public + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('start', $query); + } + + $this->last_query_text = $query; + $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + $array = array(); + if (strlen($query) > 32740) + { + if (preg_match('/^(INSERT INTO[^(]++)\\(([^()]+)\\) VALUES[^(]++\\((.*?)\\)$/s', $query, $regs)) + { + if (strlen($regs[3]) > 32740) + { + preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER); + + $inserts = $vals[0]; + unset($vals); + + foreach ($inserts as $key => $value) + { + if (!empty($value) && $value[0] === "'" && strlen($value) > 32742) // check to see if this thing is greater than the max + 'x2 + { + $inserts[$key] = '?'; + $array[] = str_replace("''", "'", substr($value, 1, -1)); + } + } + + $query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')'; + } + } + else if (preg_match_all('/^(UPDATE ([\\w_]++)\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER)) + { + if (strlen($data[0][3]) > 32740) + { + $update = $data[0][1]; + $where = $data[0][4]; + preg_match_all('/(\\w++) = (\'(?:[^\']++|\'\')*+\'|\\d++)/', $data[0][3], $temp, PREG_SET_ORDER); + unset($data); + + $cols = array(); + foreach ($temp as $value) + { + if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 32742) // check to see if this thing is greater than the max + 'x2 + { + $array[] = str_replace("''", "'", substr($value[2], 1, -1)); + $cols[] = $value[1] . '=?'; + } + else + { + $cols[] = $value[1] . '=' . $value[2]; + } + } + + $query = $update . implode(', ', $cols) . ' ' . $where; + unset($cols); + } + } + } + + if (sizeof($array)) + { + if (($this->query_result = @db2_prepare($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (!@db2_execute($this->query_result, $array)) + { + $this->sql_error($query); + } + } + else + { + if (($this->query_result = @db2_exec($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + } + + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('stop', $query); + } + + if ($cache_ttl && method_exists($cache, 'sql_save')) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $cache->sql_save($query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0 && $this->query_result) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG_EXTRA')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return ($this->query_result) ? $this->query_result : false; + } + + /** + * Build LIMIT query + */ + function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + if ($query != '') + { + $this->query_result = false; + + if ($total && $offset == 0) + { + return $this->sql_query($query . ' fetch first ' . $total . ' rows only', $cache_ttl); + } + + + // Seek by $offset rows + if ($offset) + { + $limit_sql = 'SELECT a2.* + FROM ( + SELECT ROW_NUMBER() OVER() AS rownum, a1.* + FROM ( + ' . $query . ' + ) a1 + ) a2 + WHERE a2.rownum BETWEEN ' . ($offset + 1) . ' AND ' . ($offset + $total); + return $this->sql_query($limit_sql, $cache_ttl); + } + } + else + { + return false; + } + } + + /** + * Return number of affected rows + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @db2_num_rows($this->db_connect_id) : false; + } + + /** + * Fetch current row + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id === false) + { + return false; + } + + $row = @db2_fetch_assoc($query_id); + + return $row; + } + + /** + * Seek to given row number + * rownum is zero-based + */ + function sql_rowseek($rownum, $query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + if ($query_id === false) + { + return; + } + + $this->sql_freeresult($query_id); + $query_id = $this->sql_query($this->last_query_text); + + if ($query_id === false) + { + return false; + } + + // We do not fetch the row for rownum == 0 because then the next resultset would be the second row + for ($i = 0; $i < $rownum; $i++) + { + if (!$this->sql_fetchrow($query_id)) + { + return false; + } + } + + return true; + } + + /** + * Get last inserted id after insert statement + */ + function sql_nextid() + { + $result_id = @db2_exec($this->db_connect_id, 'VALUES IDENTITY_VAL_LOCAL()'); + if ($result_id) + { + if ($row = @db2_fetch_assoc($result_id)) + { + @db2_free_result($result_id); + return (int) $row[1]; + } + @db2_free_result($result_id); + } + + return false; + } + + /** + * Free sql result + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[$query_id])) + { + unset($this->open_queries[$query_id]); + return @db2_free_result($query_id); + } + + return false; + } + + /** + * Escape string used in sql query + */ + function sql_escape($msg) + { + return str_replace("'", "''", $msg); + } + + /** + * Expose a DBMS specific function + */ + function sql_function($type, $col) + { + switch ($type) + { + case 'length_varchar': + return 'LENGTH(' . $col . ')'; + break; + + case 'length_text': + return 'LENGTH(' . $col . ')'; + break; + } + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + $error = array( + 'message' => @db2_stmt_errormsg(), + 'code' => @db2_stmt_error() + ); + return $error; + } + + /** + * Build db-specific query data + * @access private + */ + function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @db2_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $html_table = false; + @db2_exec($this->db_connect_id, 'DELETE FROM EXPLAIN_INSTANCE'); + @db2_exec($this->db_connect_id, 'EXPLAIN PLAN FOR ' . $query); + + // Get the data from the plan + $sql = "SELECT O.Operator_ID, S2.Target_ID, O.Operator_Type, S.Object_Name, CAST(O.Total_Cost AS INTEGER) Cost + FROM EXPLAIN_OPERATOR O + LEFT OUTER JOIN EXPLAIN_STREAM S2 ON O.Operator_ID = S2.Source_ID + LEFT OUTER JOIN EXPLAIN_STREAM S ON O.Operator_ID = S.Target_ID AND O.Explain_Time = S.Explain_Time AND S.Object_Name IS NOT NULL + ORDER BY O.Explain_Time ASC, Operator_ID ASC"; + $query_id = @db2_exec($this->db_connect_id, $sql); + + if ($query_id) + { + while ($row = @db2_fetch_assoc($query_id)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + + @db2_free_result($query_id); + } + + if ($html_table) + { + $this->html_hold .= '</table>'; + } + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @db2_exec($this->db_connect_id, $query); + while ($void = @db2_fetch_assoc($result, IBASE_TEXT)) + { + // Take the time spent on parsing rows into account + } + @db2_free_result($result); + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} + +?>
\ No newline at end of file diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 0919854f40..f02ec96a9f 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -181,6 +181,33 @@ class phpbb_db_tools 'VARBINARY' => 'blob', ), + 'db2' => array( + 'INT:' => 'integer', + 'BINT' => 'float', + 'UINT' => 'integer', + 'UINT:' => 'integer', + 'TINT:' => 'smallint', + 'USINT' => 'smallint', + 'BOOL' => 'smallint', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'clob(65K)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'clob(65K)', + 'MTEXT' => 'clob(16M)', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'clob(65K)', + 'MTEXT_UNI' => 'clob(16M)', + 'TIMESTAMP' => 'integer', + 'DECIMAL' => 'float', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varchar(255)', + ), + 'postgres' => array( 'INT:' => 'INT4', 'BINT' => 'INT8', @@ -505,6 +532,24 @@ class phpbb_db_tools return false; break; + case 'db2': + $sql = "SELECT colname + FROM syscat.columns + WHERE tabname = '$table'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['colname']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + return false; + break; + // ugh, SQLite case 'sqlite': $sql = "SELECT sql @@ -762,6 +807,27 @@ class phpbb_db_tools $sql .= ' NOT NULL '; $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; break; + + case 'db2': + $sql .= "\t{$column_name} {$column_type} NOT NULL"; + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $sql .= ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)'; + } + else + { + if (preg_match('/^(integer|smallint|float)$/', $column_type)) + { + $sql .= " DEFAULT {$column_data[1]}"; + } + else + { + $sql .= " DEFAULT '{$column_data[1]}'"; + } + } + $sql .= ",\n"; + break; } $return_array['column_type_sql'] = $sql; @@ -799,6 +865,10 @@ class phpbb_db_tools $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; break; + case 'db2': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + case 'sqlite': if (version_compare(sqlite_libversion(), '3.0') == -1) { @@ -890,6 +960,10 @@ class phpbb_db_tools $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; break; + case 'db2': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP ' . $column_name; + break; + case 'sqlite': if (version_compare(sqlite_libversion(), '3.0') == -1) { @@ -973,6 +1047,7 @@ class phpbb_db_tools case 'oracle': case 'postgres': case 'sqlite': + case 'db2': $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; break; } @@ -991,6 +1066,8 @@ class phpbb_db_tools { case 'firebird': case 'postgres': + case 'mysql': + case 'db2': $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; break; @@ -1003,10 +1080,6 @@ class phpbb_db_tools $statements[] = $sql; break; - case 'mysql': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; - break; - case 'oracle': $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; break; @@ -1077,6 +1150,7 @@ class phpbb_db_tools case 'postgres': case 'oracle': case 'sqlite': + case 'db2': $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; break; @@ -1105,6 +1179,7 @@ class phpbb_db_tools case 'postgres': case 'oracle': case 'sqlite': + case 'db2': $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; break; @@ -1184,6 +1259,13 @@ class phpbb_db_tools $sql = "PRAGMA index_info('" . $table_name . "');"; $col = 'name'; break; + + case 'db2': + $sql = "SELECT indname + FROM SYSCAT.INDEXES + WHERE TABNAME = '$table_name' + AND UNIQUERULE <> 'P'"; + $col = 'name'; } $result = $this->db->sql_query($sql); @@ -1200,6 +1282,7 @@ class phpbb_db_tools case 'oracle': case 'postgres': case 'sqlite': + case 'db2': $row[$col] = substr($row[$col], strlen($table_name) + 1); break; } @@ -1239,6 +1322,10 @@ class phpbb_db_tools $statements[] = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql']; break; + case 'db2': + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER ' . $column_name . ' SET DATA TYPE ' . $column_data['column_type_sql']; + break; + case 'postgres': $sql = 'ALTER TABLE ' . $table_name . ' '; diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 36b38a6036..97775eacf7 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -82,6 +82,16 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'AVAILABLE' => true, '2.0.x' => true, ), + 'db2' => array( + 'LABEL' => 'IBM DB2', + 'SCHEMA' => 'db2', + 'MODULE' => 'ibm_db2', + 'DELIM' => ';', + 'COMMENTS' => 'remove_comments', + 'DRIVER' => 'db2', + 'AVAILABLE' => true, + '2.0.x' => false, + ), 'oracle' => array( 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', @@ -223,6 +233,14 @@ function get_tables($db) AND rdb$system_flag = 0'; break; + case 'db2': + $sql = "SELECT tabname + FROM SYSCAT.TABLES + WHERE type = 'T' + AND tabschema = 'DB2ADMIN'"; + $field = 'tabname'; + break; + case 'oracle': $sql = 'SELECT table_name FROM USER_TABLES'; @@ -302,6 +320,10 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $prefix_length = 90; break; + case 'db2': + $prefix_length = 108; + break; + case 'sqlite': $prefix_length = 200; break; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 84e75670fb..bacb4462c6 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -167,7 +167,7 @@ function user_add($user_row, $cp_data = false) 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', 'user_pass_convert' => 0, 'user_email' => strtolower($user_row['user_email']), - 'user_email_hash' => crc32(strtolower($user_row['user_email'])) . strlen($user_row['user_email']), + 'user_email_hash' => hexdec(crc32(strtolower($user_row['user_email'])) . strlen($user_row['user_email'])), 'group_id' => $user_row['group_id'], 'user_type' => $user_row['user_type'], ); @@ -1541,7 +1541,7 @@ function validate_email($email, $allowed_email = false) { $sql = 'SELECT user_email_hash FROM ' . USERS_TABLE . " - WHERE user_email_hash = " . (crc32($email) . strlen($email)); + WHERE user_email_hash = " . hexdec(crc32($email) . strlen($email)); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 0f3cc218c3..a223d5232e 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -110,7 +110,7 @@ class ucp_profile 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], - 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32($data['email']) . strlen($data['email']) : $user->data['user_email_hash'], + 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? hexdec(crc32($data['email']) . strlen($data['email'])) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d0dbada4b4..1ab63dd321 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -250,6 +250,33 @@ $dbms_type_map = array( 'VARBINARY' => 'raw(255)', ), + 'db2' => array( + 'INT:' => 'integer', + 'BINT' => 'float', + 'UINT' => 'integer', + 'UINT:' => 'integer', + 'TINT:' => 'smallint', + 'USINT' => 'smallint', + 'BOOL' => 'smallint', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'clob(65K)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'clob(65K)', + 'MTEXT' => 'clob(16M)', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'clob(65K)', + 'MTEXT_UNI' => 'clob(16M)', + 'TIMESTAMP' => 'integer', + 'DECIMAL' => 'float', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varchar(255)', + ), + 'sqlite' => array( 'INT:' => 'int(%d)', 'BINT' => 'bigint(20)', diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 9e95538313..d91d67a065 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -924,8 +924,8 @@ class install_install extends module unset($config_data_array); $config_data .= "\n@define('PHPBB_INSTALLED', true);\n"; - $config_data .= "// @define('DEBUG', true);\n"; - $config_data .= "// @define('DEBUG_EXTRA', true);\n"; + $config_data .= "@define('DEBUG', true);\n"; + $config_data .= "@define('DEBUG_EXTRA', true);\n"; $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... @@ -1327,7 +1327,7 @@ class install_install extends module WHERE config_name = 'avatar_salt'", 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . (crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' + SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . hexdec(crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' WHERE username = 'Admin'", 'UPDATE ' . $data['table_prefix'] . "moderator_cache diff --git a/phpBB/install/schemas/db2_schema.sql b/phpBB/install/schemas/db2_schema.sql new file mode 100644 index 0000000000..3e1482be47 --- /dev/null +++ b/phpBB/install/schemas/db2_schema.sql @@ -0,0 +1,1122 @@ +/* + + $Id$ + +*/ + +/* + Table: 'phpbb_attachments' +*/ +CREATE TABLE phpbb_attachments ( + attach_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + post_msg_id integer NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + in_message smallint NOT NULL DEFAULT 0, + poster_id integer NOT NULL DEFAULT 0, + is_orphan smallint NOT NULL DEFAULT 1, + physical_filename varchar(255) NOT NULL DEFAULT '', + real_filename varchar(255) NOT NULL DEFAULT '', + download_count integer NOT NULL DEFAULT 0, + attach_comment clob(65K) NOT NULL DEFAULT '', + extension varchar(100) NOT NULL DEFAULT '', + mimetype varchar(100) NOT NULL DEFAULT '', + filesize integer NOT NULL DEFAULT 0, + filetime integer NOT NULL DEFAULT 0, + thumbnail smallint NOT NULL DEFAULT 0, + PRIMARY KEY (attach_id) +); + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE phpbb_acl_groups ( + group_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + auth_option_id integer NOT NULL DEFAULT 0, + auth_role_id integer NOT NULL DEFAULT 0, + auth_setting smallint NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE phpbb_acl_options ( + auth_option_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + auth_option varchar(50) NOT NULL DEFAULT '', + is_global smallint NOT NULL DEFAULT 0, + is_local smallint NOT NULL DEFAULT 0, + founder_only smallint NOT NULL DEFAULT 0, + PRIMARY KEY (auth_option_id) +); + +CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE phpbb_acl_roles ( + role_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + role_name varchar(255) NOT NULL DEFAULT '', + role_description clob(65K) NOT NULL DEFAULT '', + role_type varchar(10) NOT NULL DEFAULT '', + role_order smallint NOT NULL DEFAULT 0, + PRIMARY KEY (role_id) +); + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE phpbb_acl_roles_data ( + role_id integer NOT NULL DEFAULT 0, + auth_option_id integer NOT NULL DEFAULT 0, + auth_setting smallint NOT NULL DEFAULT 0, + PRIMARY KEY (role_id, auth_option_id) +); + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE phpbb_acl_users ( + user_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + auth_option_id integer NOT NULL DEFAULT 0, + auth_role_id integer NOT NULL DEFAULT 0, + auth_setting smallint NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE phpbb_banlist ( + ban_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + ban_userid integer NOT NULL DEFAULT 0, + ban_ip varchar(40) NOT NULL DEFAULT '', + ban_email varchar(100) NOT NULL DEFAULT '', + ban_start integer NOT NULL DEFAULT 0, + ban_end integer NOT NULL DEFAULT 0, + ban_exclude smallint NOT NULL DEFAULT 0, + ban_reason varchar(255) NOT NULL DEFAULT '', + ban_give_reason varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (ban_id) +); + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id smallint NOT NULL DEFAULT 0, + bbcode_tag varchar(16) NOT NULL DEFAULT '', + bbcode_helpline varchar(255) NOT NULL DEFAULT '', + display_on_posting smallint NOT NULL DEFAULT 0, + bbcode_match clob(65K) NOT NULL DEFAULT '', + bbcode_tpl clob(16M) NOT NULL DEFAULT '', + first_pass_match clob(16M) NOT NULL DEFAULT '', + first_pass_replace clob(16M) NOT NULL DEFAULT '', + second_pass_match clob(16M) NOT NULL DEFAULT '', + second_pass_replace clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (bbcode_id) +); + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + PRIMARY KEY (topic_id, user_id) +); + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE phpbb_bots ( + bot_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + bot_active smallint NOT NULL DEFAULT 1, + bot_name varchar(255) NOT NULL DEFAULT '', + user_id integer NOT NULL DEFAULT 0, + bot_agent varchar(255) NOT NULL DEFAULT '', + bot_ip varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (bot_id) +); + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE phpbb_config ( + config_name varchar(255) NOT NULL DEFAULT '', + config_value varchar(255) NOT NULL DEFAULT '', + is_dynamic smallint NOT NULL DEFAULT 0, + PRIMARY KEY (config_name) +); + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE phpbb_confirm ( + confirm_id char(32) NOT NULL DEFAULT '', + session_id char(32) NOT NULL DEFAULT '', + confirm_type smallint NOT NULL DEFAULT 0, + code varchar(8) NOT NULL DEFAULT '', + seed integer NOT NULL DEFAULT 0, + PRIMARY KEY (session_id, confirm_id) +); + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE phpbb_disallow ( + disallow_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + disallow_username varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (disallow_id) +); + + +/* + Table: 'phpbb_drafts' +*/ +CREATE TABLE phpbb_drafts ( + draft_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + user_id integer NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + save_time integer NOT NULL DEFAULT 0, + draft_subject varchar(100) NOT NULL DEFAULT '', + draft_message clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (draft_id) +); + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_extensions' +*/ +CREATE TABLE phpbb_extensions ( + extension_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + group_id integer NOT NULL DEFAULT 0, + extension varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (extension_id) +); + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE TABLE phpbb_extension_groups ( + group_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + group_name varchar(255) NOT NULL DEFAULT '', + cat_id smallint NOT NULL DEFAULT 0, + allow_group smallint NOT NULL DEFAULT 0, + download_mode smallint NOT NULL DEFAULT 1, + upload_icon varchar(255) NOT NULL DEFAULT '', + max_filesize integer NOT NULL DEFAULT 0, + allowed_forums clob(65K) NOT NULL DEFAULT '', + allow_in_pm smallint NOT NULL DEFAULT 0, + PRIMARY KEY (group_id) +); + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE phpbb_forums ( + forum_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + parent_id integer NOT NULL DEFAULT 0, + left_id integer NOT NULL DEFAULT 0, + right_id integer NOT NULL DEFAULT 0, + forum_parents clob(16M) NOT NULL DEFAULT '', + forum_name varchar(255) NOT NULL DEFAULT '', + forum_desc clob(65K) NOT NULL DEFAULT '', + forum_desc_bitfield varchar(255) NOT NULL DEFAULT '', + forum_desc_options integer NOT NULL DEFAULT 7, + forum_desc_uid varchar(8) NOT NULL DEFAULT '', + forum_link varchar(255) NOT NULL DEFAULT '', + forum_password varchar(40) NOT NULL DEFAULT '', + forum_style smallint NOT NULL DEFAULT 0, + forum_image varchar(255) NOT NULL DEFAULT '', + forum_rules clob(65K) NOT NULL DEFAULT '', + forum_rules_link varchar(255) NOT NULL DEFAULT '', + forum_rules_bitfield varchar(255) NOT NULL DEFAULT '', + forum_rules_options integer NOT NULL DEFAULT 7, + forum_rules_uid varchar(8) NOT NULL DEFAULT '', + forum_topics_per_page smallint NOT NULL DEFAULT 0, + forum_type smallint NOT NULL DEFAULT 0, + forum_status smallint NOT NULL DEFAULT 0, + forum_posts integer NOT NULL DEFAULT 0, + forum_topics integer NOT NULL DEFAULT 0, + forum_topics_real integer NOT NULL DEFAULT 0, + forum_last_post_id integer NOT NULL DEFAULT 0, + forum_last_poster_id integer NOT NULL DEFAULT 0, + forum_last_post_subject varchar(100) NOT NULL DEFAULT '', + forum_last_post_time integer NOT NULL DEFAULT 0, + forum_last_poster_name varchar(255) NOT NULL DEFAULT '', + forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', + forum_flags smallint NOT NULL DEFAULT 32, + display_on_index smallint NOT NULL DEFAULT 1, + enable_indexing smallint NOT NULL DEFAULT 1, + enable_icons smallint NOT NULL DEFAULT 1, + enable_prune smallint NOT NULL DEFAULT 0, + prune_next integer NOT NULL DEFAULT 0, + prune_days integer NOT NULL DEFAULT 0, + prune_viewed integer NOT NULL DEFAULT 0, + prune_freq integer NOT NULL DEFAULT 0, + PRIMARY KEY (forum_id) +); + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE phpbb_forums_access ( + forum_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + session_id char(32) NOT NULL DEFAULT '', + PRIMARY KEY (forum_id, user_id, session_id) +); + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE phpbb_forums_track ( + user_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + mark_time integer NOT NULL DEFAULT 0, + PRIMARY KEY (user_id, forum_id) +); + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE phpbb_forums_watch ( + forum_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + notify_status smallint NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE phpbb_groups ( + group_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + group_type smallint NOT NULL DEFAULT 1, + group_founder_manage smallint NOT NULL DEFAULT 0, + group_name varchar(255) NOT NULL DEFAULT '', + group_desc clob(65K) NOT NULL DEFAULT '', + group_desc_bitfield varchar(255) NOT NULL DEFAULT '', + group_desc_options integer NOT NULL DEFAULT 7, + group_desc_uid varchar(8) NOT NULL DEFAULT '', + group_display smallint NOT NULL DEFAULT 0, + group_avatar varchar(255) NOT NULL DEFAULT '', + group_avatar_type smallint NOT NULL DEFAULT 0, + group_avatar_width smallint NOT NULL DEFAULT 0, + group_avatar_height smallint NOT NULL DEFAULT 0, + group_rank integer NOT NULL DEFAULT 0, + group_colour varchar(6) NOT NULL DEFAULT '', + group_sig_chars integer NOT NULL DEFAULT 0, + group_receive_pm smallint NOT NULL DEFAULT 0, + group_message_limit integer NOT NULL DEFAULT 0, + group_legend smallint NOT NULL DEFAULT 1, + PRIMARY KEY (group_id) +); + +CREATE INDEX phpbb_groups_group_legend ON phpbb_groups (group_legend) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE phpbb_icons ( + icons_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + icons_url varchar(255) NOT NULL DEFAULT '', + icons_width smallint NOT NULL DEFAULT 0, + icons_height smallint NOT NULL DEFAULT 0, + icons_order integer NOT NULL DEFAULT 0, + display_on_posting smallint NOT NULL DEFAULT 1, + PRIMARY KEY (icons_id) +); + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE phpbb_lang ( + lang_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + lang_iso varchar(30) NOT NULL DEFAULT '', + lang_dir varchar(30) NOT NULL DEFAULT '', + lang_english_name varchar(100) NOT NULL DEFAULT '', + lang_local_name varchar(255) NOT NULL DEFAULT '', + lang_author varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (lang_id) +); + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_log' +*/ +CREATE TABLE phpbb_log ( + log_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + log_type smallint NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + reportee_id integer NOT NULL DEFAULT 0, + log_ip varchar(40) NOT NULL DEFAULT '', + log_time integer NOT NULL DEFAULT 0, + log_operation clob(65K) NOT NULL DEFAULT '', + log_data clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (log_id) +); + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + username varchar(255) NOT NULL DEFAULT '', + group_id integer NOT NULL DEFAULT 0, + group_name varchar(255) NOT NULL DEFAULT '', + display_on_index smallint NOT NULL DEFAULT 1 +); + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE phpbb_modules ( + module_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + module_enabled smallint NOT NULL DEFAULT 1, + module_display smallint NOT NULL DEFAULT 1, + module_basename varchar(255) NOT NULL DEFAULT '', + module_class varchar(10) NOT NULL DEFAULT '', + parent_id integer NOT NULL DEFAULT 0, + left_id integer NOT NULL DEFAULT 0, + right_id integer NOT NULL DEFAULT 0, + module_langname varchar(255) NOT NULL DEFAULT '', + module_mode varchar(255) NOT NULL DEFAULT '', + module_auth varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (module_id) +); + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE phpbb_poll_options ( + poll_option_id smallint NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + poll_option_text clob(65K) NOT NULL DEFAULT '', + poll_option_total integer NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE phpbb_poll_votes ( + topic_id integer NOT NULL DEFAULT 0, + poll_option_id smallint NOT NULL DEFAULT 0, + vote_user_id integer NOT NULL DEFAULT 0, + vote_user_ip varchar(40) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE phpbb_posts ( + post_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + topic_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + poster_id integer NOT NULL DEFAULT 0, + icon_id integer NOT NULL DEFAULT 0, + poster_ip varchar(40) NOT NULL DEFAULT '', + post_time integer NOT NULL DEFAULT 0, + post_approved smallint NOT NULL DEFAULT 1, + post_reported smallint NOT NULL DEFAULT 0, + enable_bbcode smallint NOT NULL DEFAULT 1, + enable_smilies smallint NOT NULL DEFAULT 1, + enable_magic_url smallint NOT NULL DEFAULT 1, + enable_sig smallint NOT NULL DEFAULT 1, + post_username varchar(255) NOT NULL DEFAULT '', + post_subject varchar(100) NOT NULL DEFAULT '', + post_text clob(16M) NOT NULL DEFAULT '', + post_checksum varchar(32) NOT NULL DEFAULT '', + post_attachment smallint NOT NULL DEFAULT 0, + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + post_postcount smallint NOT NULL DEFAULT 1, + post_edit_time integer NOT NULL DEFAULT 0, + post_edit_reason varchar(255) NOT NULL DEFAULT '', + post_edit_user integer NOT NULL DEFAULT 0, + post_edit_count smallint NOT NULL DEFAULT 0, + post_edit_locked smallint NOT NULL DEFAULT 0, + PRIMARY KEY (post_id) +); + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE phpbb_privmsgs ( + msg_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + root_level integer NOT NULL DEFAULT 0, + author_id integer NOT NULL DEFAULT 0, + icon_id integer NOT NULL DEFAULT 0, + author_ip varchar(40) NOT NULL DEFAULT '', + message_time integer NOT NULL DEFAULT 0, + enable_bbcode smallint NOT NULL DEFAULT 1, + enable_smilies smallint NOT NULL DEFAULT 1, + enable_magic_url smallint NOT NULL DEFAULT 1, + enable_sig smallint NOT NULL DEFAULT 1, + message_subject varchar(100) NOT NULL DEFAULT '', + message_text clob(16M) NOT NULL DEFAULT '', + message_edit_reason varchar(255) NOT NULL DEFAULT '', + message_edit_user integer NOT NULL DEFAULT 0, + message_attachment smallint NOT NULL DEFAULT 0, + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + message_edit_time integer NOT NULL DEFAULT 0, + message_edit_count smallint NOT NULL DEFAULT 0, + to_address clob(65K) NOT NULL DEFAULT '', + bcc_address clob(65K) NOT NULL DEFAULT '', + PRIMARY KEY (msg_id) +); + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE TABLE phpbb_privmsgs_folder ( + folder_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + user_id integer NOT NULL DEFAULT 0, + folder_name varchar(255) NOT NULL DEFAULT '', + pm_count integer NOT NULL DEFAULT 0, + PRIMARY KEY (folder_id) +); + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE TABLE phpbb_privmsgs_rules ( + rule_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + user_id integer NOT NULL DEFAULT 0, + rule_check integer NOT NULL DEFAULT 0, + rule_connection integer NOT NULL DEFAULT 0, + rule_string varchar(255) NOT NULL DEFAULT '', + rule_user_id integer NOT NULL DEFAULT 0, + rule_group_id integer NOT NULL DEFAULT 0, + rule_action integer NOT NULL DEFAULT 0, + rule_folder_id integer NOT NULL DEFAULT 0, + PRIMARY KEY (rule_id) +); + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE phpbb_privmsgs_to ( + msg_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + author_id integer NOT NULL DEFAULT 0, + pm_deleted smallint NOT NULL DEFAULT 0, + pm_new smallint NOT NULL DEFAULT 1, + pm_unread smallint NOT NULL DEFAULT 1, + pm_replied smallint NOT NULL DEFAULT 0, + pm_marked smallint NOT NULL DEFAULT 0, + pm_forwarded smallint NOT NULL DEFAULT 0, + folder_id integer NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE phpbb_profile_fields ( + field_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + field_name varchar(255) NOT NULL DEFAULT '', + field_type smallint NOT NULL DEFAULT 0, + field_ident varchar(20) NOT NULL DEFAULT '', + field_length varchar(20) NOT NULL DEFAULT '', + field_minlen varchar(255) NOT NULL DEFAULT '', + field_maxlen varchar(255) NOT NULL DEFAULT '', + field_novalue varchar(255) NOT NULL DEFAULT '', + field_default_value varchar(255) NOT NULL DEFAULT '', + field_validation varchar(20) NOT NULL DEFAULT '', + field_required smallint NOT NULL DEFAULT 0, + field_show_on_reg smallint NOT NULL DEFAULT 0, + field_hide smallint NOT NULL DEFAULT 0, + field_no_view smallint NOT NULL DEFAULT 0, + field_active smallint NOT NULL DEFAULT 0, + field_order integer NOT NULL DEFAULT 0, + PRIMARY KEY (field_id) +); + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE phpbb_profile_fields_data ( + user_id integer NOT NULL DEFAULT 0, + PRIMARY KEY (user_id) +); + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE phpbb_profile_fields_lang ( + field_id integer NOT NULL DEFAULT 0, + lang_id integer NOT NULL DEFAULT 0, + option_id integer NOT NULL DEFAULT 0, + field_type smallint NOT NULL DEFAULT 0, + lang_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id, option_id) +); + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE phpbb_profile_lang ( + field_id integer NOT NULL DEFAULT 0, + lang_id integer NOT NULL DEFAULT 0, + lang_name varchar(255) NOT NULL DEFAULT '', + lang_explain clob(65K) NOT NULL DEFAULT '', + lang_default_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id) +); + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE phpbb_ranks ( + rank_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + rank_title varchar(255) NOT NULL DEFAULT '', + rank_min integer NOT NULL DEFAULT 0, + rank_special smallint NOT NULL DEFAULT 0, + rank_image varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (rank_id) +); + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE phpbb_reports ( + report_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + reason_id smallint NOT NULL DEFAULT 0, + post_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + user_notify smallint NOT NULL DEFAULT 0, + report_closed smallint NOT NULL DEFAULT 0, + report_time integer NOT NULL DEFAULT 0, + report_text clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (report_id) +); + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + reason_title varchar(255) NOT NULL DEFAULT '', + reason_description clob(16M) NOT NULL DEFAULT '', + reason_order smallint NOT NULL DEFAULT 0, + PRIMARY KEY (reason_id) +); + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE phpbb_search_results ( + search_key varchar(32) NOT NULL DEFAULT '', + search_time integer NOT NULL DEFAULT 0, + search_keywords clob(16M) NOT NULL DEFAULT '', + search_authors clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (search_key) +); + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE phpbb_search_wordlist ( + word_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + word_text varchar(255) NOT NULL DEFAULT '', + word_common smallint NOT NULL DEFAULT 0, + word_count integer NOT NULL DEFAULT 0, + PRIMARY KEY (word_id) +); + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE phpbb_search_wordmatch ( + post_id integer NOT NULL DEFAULT 0, + word_id integer NOT NULL DEFAULT 0, + title_match smallint NOT NULL DEFAULT 0 +); + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE phpbb_sessions ( + session_id char(32) NOT NULL DEFAULT '', + session_user_id integer NOT NULL DEFAULT 0, + session_last_visit integer NOT NULL DEFAULT 0, + session_start integer NOT NULL DEFAULT 0, + session_time integer NOT NULL DEFAULT 0, + session_ip varchar(40) NOT NULL DEFAULT '', + session_browser varchar(150) NOT NULL DEFAULT '', + session_forwarded_for varchar(255) NOT NULL DEFAULT '', + session_page varchar(255) NOT NULL DEFAULT '', + session_viewonline smallint NOT NULL DEFAULT 1, + session_autologin smallint NOT NULL DEFAULT 0, + session_admin smallint NOT NULL DEFAULT 0, + PRIMARY KEY (session_id) +); + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) NOT NULL DEFAULT '', + user_id integer NOT NULL DEFAULT 0, + last_ip varchar(40) NOT NULL DEFAULT '', + last_login integer NOT NULL DEFAULT 0, + PRIMARY KEY (key_id, user_id) +); + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_sitelist' +*/ +CREATE TABLE phpbb_sitelist ( + site_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + site_ip varchar(40) NOT NULL DEFAULT '', + site_hostname varchar(255) NOT NULL DEFAULT '', + ip_exclude smallint NOT NULL DEFAULT 0, + PRIMARY KEY (site_id) +); + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE phpbb_smilies ( + smiley_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + code varchar(50) NOT NULL DEFAULT '', + emotion varchar(50) NOT NULL DEFAULT '', + smiley_url varchar(50) NOT NULL DEFAULT '', + smiley_width smallint NOT NULL DEFAULT 0, + smiley_height smallint NOT NULL DEFAULT 0, + smiley_order integer NOT NULL DEFAULT 0, + display_on_posting smallint NOT NULL DEFAULT 1, + PRIMARY KEY (smiley_id) +); + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE phpbb_styles ( + style_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + style_name varchar(255) NOT NULL DEFAULT '', + style_copyright varchar(255) NOT NULL DEFAULT '', + style_active smallint NOT NULL DEFAULT 1, + template_id smallint NOT NULL DEFAULT 0, + theme_id smallint NOT NULL DEFAULT 0, + imageset_id smallint NOT NULL DEFAULT 0, + PRIMARY KEY (style_id) +); + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles_template' +*/ +CREATE TABLE phpbb_styles_template ( + template_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + template_name varchar(255) NOT NULL DEFAULT '', + template_copyright varchar(255) NOT NULL DEFAULT '', + template_path varchar(100) NOT NULL DEFAULT '', + bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=', + template_storedb smallint NOT NULL DEFAULT 0, + PRIMARY KEY (template_id) +); + +CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (template_name) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles_template_data' +*/ +CREATE TABLE phpbb_styles_template_data ( + template_id smallint NOT NULL DEFAULT 0, + template_filename varchar(100) NOT NULL DEFAULT '', + template_included clob(65K) NOT NULL DEFAULT '', + template_mtime integer NOT NULL DEFAULT 0, + template_data clob(16M) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles_theme' +*/ +CREATE TABLE phpbb_styles_theme ( + theme_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + theme_name varchar(255) NOT NULL DEFAULT '', + theme_copyright varchar(255) NOT NULL DEFAULT '', + theme_path varchar(100) NOT NULL DEFAULT '', + theme_storedb smallint NOT NULL DEFAULT 0, + theme_mtime integer NOT NULL DEFAULT 0, + theme_data clob(16M) NOT NULL DEFAULT '', + PRIMARY KEY (theme_id) +); + +CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles_imageset' +*/ +CREATE TABLE phpbb_styles_imageset ( + imageset_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + imageset_name varchar(255) NOT NULL DEFAULT '', + imageset_copyright varchar(255) NOT NULL DEFAULT '', + imageset_path varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (imageset_id) +); + +CREATE UNIQUE INDEX phpbb_styles_imageset_imgset_nm ON phpbb_styles_imageset (imageset_name) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_styles_imageset_data' +*/ +CREATE TABLE phpbb_styles_imageset_data ( + image_id smallint NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + image_name varchar(200) NOT NULL DEFAULT '', + image_filename varchar(200) NOT NULL DEFAULT '', + image_lang varchar(30) NOT NULL DEFAULT '', + image_height smallint NOT NULL DEFAULT 0, + image_width smallint NOT NULL DEFAULT 0, + imageset_id smallint NOT NULL DEFAULT 0, + PRIMARY KEY (image_id) +); + +CREATE INDEX phpbb_styles_imageset_data_i_d ON phpbb_styles_imageset_data (imageset_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE phpbb_topics ( + topic_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + forum_id integer NOT NULL DEFAULT 0, + icon_id integer NOT NULL DEFAULT 0, + topic_attachment smallint NOT NULL DEFAULT 0, + topic_approved smallint NOT NULL DEFAULT 1, + topic_reported smallint NOT NULL DEFAULT 0, + topic_title varchar(100) NOT NULL DEFAULT '', + topic_poster integer NOT NULL DEFAULT 0, + topic_time integer NOT NULL DEFAULT 0, + topic_time_limit integer NOT NULL DEFAULT 0, + topic_views integer NOT NULL DEFAULT 0, + topic_replies integer NOT NULL DEFAULT 0, + topic_replies_real integer NOT NULL DEFAULT 0, + topic_status smallint NOT NULL DEFAULT 0, + topic_type smallint NOT NULL DEFAULT 0, + topic_first_post_id integer NOT NULL DEFAULT 0, + topic_first_poster_name varchar(255) NOT NULL DEFAULT '', + topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_id integer NOT NULL DEFAULT 0, + topic_last_poster_id integer NOT NULL DEFAULT 0, + topic_last_poster_name varchar(255) NOT NULL DEFAULT '', + topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_subject varchar(100) NOT NULL DEFAULT '', + topic_last_post_time integer NOT NULL DEFAULT 0, + topic_last_view_time integer NOT NULL DEFAULT 0, + topic_moved_id integer NOT NULL DEFAULT 0, + topic_bumped smallint NOT NULL DEFAULT 0, + topic_bumper integer NOT NULL DEFAULT 0, + poll_title varchar(255) NOT NULL DEFAULT '', + poll_start integer NOT NULL DEFAULT 0, + poll_length integer NOT NULL DEFAULT 0, + poll_max_options smallint NOT NULL DEFAULT 1, + poll_last_vote integer NOT NULL DEFAULT 0, + poll_vote_change smallint NOT NULL DEFAULT 0, + PRIMARY KEY (topic_id) +); + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE phpbb_topics_track ( + user_id integer NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + forum_id integer NOT NULL DEFAULT 0, + mark_time integer NOT NULL DEFAULT 0, + PRIMARY KEY (user_id, topic_id) +); + +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE phpbb_topics_posted ( + user_id integer NOT NULL DEFAULT 0, + topic_id integer NOT NULL DEFAULT 0, + topic_posted smallint NOT NULL DEFAULT 0, + PRIMARY KEY (user_id, topic_id) +); + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE phpbb_topics_watch ( + topic_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + notify_status smallint NOT NULL DEFAULT 0 +); + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE phpbb_user_group ( + group_id integer NOT NULL DEFAULT 0, + user_id integer NOT NULL DEFAULT 0, + group_leader smallint NOT NULL DEFAULT 0, + user_pending smallint NOT NULL DEFAULT 1 +); + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE phpbb_users ( + user_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + user_type smallint NOT NULL DEFAULT 0, + group_id integer NOT NULL DEFAULT 3, + user_permissions clob(16M) NOT NULL DEFAULT '', + user_perm_from integer NOT NULL DEFAULT 0, + user_ip varchar(40) NOT NULL DEFAULT '', + user_regdate integer NOT NULL DEFAULT 0, + username varchar(255) NOT NULL DEFAULT '', + username_clean varchar(255) NOT NULL DEFAULT '', + user_password varchar(40) NOT NULL DEFAULT '', + user_passchg integer NOT NULL DEFAULT 0, + user_pass_convert smallint NOT NULL DEFAULT 0, + user_email varchar(100) NOT NULL DEFAULT '', + user_email_hash float NOT NULL DEFAULT 0, + user_birthday varchar(10) NOT NULL DEFAULT '', + user_lastvisit integer NOT NULL DEFAULT 0, + user_lastmark integer NOT NULL DEFAULT 0, + user_lastpost_time integer NOT NULL DEFAULT 0, + user_lastpage varchar(200) NOT NULL DEFAULT '', + user_last_confirm_key varchar(10) NOT NULL DEFAULT '', + user_last_search integer NOT NULL DEFAULT 0, + user_warnings smallint NOT NULL DEFAULT 0, + user_last_warning integer NOT NULL DEFAULT 0, + user_login_attempts smallint NOT NULL DEFAULT 0, + user_inactive_reason smallint NOT NULL DEFAULT 0, + user_inactive_time integer NOT NULL DEFAULT 0, + user_posts integer NOT NULL DEFAULT 0, + user_lang varchar(30) NOT NULL DEFAULT '', + user_timezone float NOT NULL DEFAULT 0, + user_dst smallint NOT NULL DEFAULT 0, + user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', + user_style smallint NOT NULL DEFAULT 0, + user_rank integer NOT NULL DEFAULT 0, + user_colour varchar(6) NOT NULL DEFAULT '', + user_new_privmsg integer NOT NULL DEFAULT 0, + user_unread_privmsg integer NOT NULL DEFAULT 0, + user_last_privmsg integer NOT NULL DEFAULT 0, + user_message_rules smallint NOT NULL DEFAULT 0, + user_full_folder integer NOT NULL DEFAULT -3, + user_emailtime integer NOT NULL DEFAULT 0, + user_topic_show_days smallint NOT NULL DEFAULT 0, + user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', + user_post_show_days smallint NOT NULL DEFAULT 0, + user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', + user_notify smallint NOT NULL DEFAULT 0, + user_notify_pm smallint NOT NULL DEFAULT 1, + user_notify_type smallint NOT NULL DEFAULT 0, + user_allow_pm smallint NOT NULL DEFAULT 1, + user_allow_viewonline smallint NOT NULL DEFAULT 1, + user_allow_viewemail smallint NOT NULL DEFAULT 1, + user_allow_massemail smallint NOT NULL DEFAULT 1, + user_options integer NOT NULL DEFAULT 895, + user_avatar varchar(255) NOT NULL DEFAULT '', + user_avatar_type smallint NOT NULL DEFAULT 0, + user_avatar_width smallint NOT NULL DEFAULT 0, + user_avatar_height smallint NOT NULL DEFAULT 0, + user_sig clob(16M) NOT NULL DEFAULT '', + user_sig_bbcode_uid varchar(8) NOT NULL DEFAULT '', + user_sig_bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + user_from varchar(100) NOT NULL DEFAULT '', + user_icq varchar(15) NOT NULL DEFAULT '', + user_aim varchar(255) NOT NULL DEFAULT '', + user_yim varchar(255) NOT NULL DEFAULT '', + user_msnm varchar(255) NOT NULL DEFAULT '', + user_jabber varchar(255) NOT NULL DEFAULT '', + user_website varchar(200) NOT NULL DEFAULT '', + user_occ clob(65K) NOT NULL DEFAULT '', + user_interests clob(65K) NOT NULL DEFAULT '', + user_actkey varchar(32) NOT NULL DEFAULT '', + user_newpasswd varchar(40) NOT NULL DEFAULT '', + user_form_salt varchar(32) NOT NULL DEFAULT '', + PRIMARY KEY (user_id) +); + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean) PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS; + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE phpbb_warnings ( + warning_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + user_id integer NOT NULL DEFAULT 0, + post_id integer NOT NULL DEFAULT 0, + log_id integer NOT NULL DEFAULT 0, + warning_time integer NOT NULL DEFAULT 0, + PRIMARY KEY (warning_id) +); + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE phpbb_words ( + word_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + word varchar(255) NOT NULL DEFAULT '', + replacement varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (word_id) +); + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE phpbb_zebra ( + user_id integer NOT NULL DEFAULT 0, + zebra_id integer NOT NULL DEFAULT 0, + friend smallint NOT NULL DEFAULT 0, + foe smallint NOT NULL DEFAULT 0, + PRIMARY KEY (user_id, zebra_id) +); + + diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 466132d55a..4a81d2623a 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -140,6 +140,7 @@ $lang = array_merge($lang, array( 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', 'DIRECTORIES_AND_FILES' => 'Directory and file setup', 'DISABLE_KEYS' => 'Disabling keys', + 'DLL_DB2' => 'DB2', 'DLL_FIREBIRD' => 'Firebird', 'DLL_FTP' => 'Remote FTP support [ Installation ]', 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', @@ -211,6 +212,7 @@ $lang = array_merge($lang, array( <li>Firebird 2.0+</li> <li>MS SQL Server 2000 or above (directly or via ODBC)</li> <li>Oracle</li> + <li>IBM DB2</li> </ul> <p>Only those databases supported on your server will be displayed.', |