diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2005-05-05 17:01:07 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2005-05-05 17:01:07 +0000 |
commit | 81c7144f6847e964057762e94dc197ac77a8f24e (patch) | |
tree | d84aed9aaf8c78ef4e199b9d20ebf54d86fbc378 /phpBB | |
parent | b576d6af0a9c0c78f379ca09069648d87364e1a0 (diff) | |
download | forums-81c7144f6847e964057762e94dc197ac77a8f24e.tar forums-81c7144f6847e964057762e94dc197ac77a8f24e.tar.gz forums-81c7144f6847e964057762e94dc197ac77a8f24e.tar.bz2 forums-81c7144f6847e964057762e94dc197ac77a8f24e.tar.xz forums-81c7144f6847e964057762e94dc197ac77a8f24e.zip |
- updated oracle schema/db files
- updated sqlite schema/db files
git-svn-id: file:///svn/phpbb/trunk@5141 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/db/firebird.php | 3 | ||||
-rw-r--r-- | phpBB/includes/db/mysql.php | 2 | ||||
-rw-r--r-- | phpBB/includes/db/mysql4.php | 2 | ||||
-rw-r--r-- | phpBB/includes/db/oracle.php | 712 | ||||
-rw-r--r-- | phpBB/includes/db/sqlite.php | 283 | ||||
-rw-r--r-- | phpBB/install/install.php | 14 | ||||
-rw-r--r-- | phpBB/install/schemas/firebird_schema.sql | 2 | ||||
-rw-r--r-- | phpBB/install/schemas/mssql_schema.sql | 4 | ||||
-rw-r--r-- | phpBB/install/schemas/mysql_schema.sql | 4 | ||||
-rw-r--r-- | phpBB/install/schemas/oracle_schema.sql | 2265 | ||||
-rw-r--r-- | phpBB/install/schemas/postgres_schema.sql | 3 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 | ||||
-rw-r--r-- | phpBB/install/schemas/sqlite_schema.sql | 1408 |
13 files changed, 3071 insertions, 1633 deletions
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index afce881eaf..a785c7c8b7 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -228,7 +228,7 @@ class sql_db // don't want this here by a middle Milestone function sql_numrows($query_id = false) { - return FALSE; + return false; } function sql_affectedrows() @@ -332,6 +332,7 @@ class sql_db } } } + return $result; } else diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index bbc4b5d289..b12480e9f9 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -337,8 +337,10 @@ class sql_db } } } + return $result; } + return false; } diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index bf323ec54e..b411b91a7a 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -337,8 +337,10 @@ class sql_db } } } + return $result; } + return false; } diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 145afc7e71..ad4a25cf60 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -11,10 +11,10 @@ /** * @ignore */ -if(!defined("SQL_LAYER")) +if(!defined('SQL_LAYER')) { -define("SQL_LAYER","oracle"); +define('SQL_LAYER', 'oracle'); /** * @package dbal_oracle @@ -22,42 +22,26 @@ define("SQL_LAYER","oracle"); */ class sql_db { - var $db_connect_id; var $query_result; - var $in_transaction = 0; - var $row = array(); - var $rowset = array(); + var $return_on_error = false; + var $transaction = false; + var $sql_time = 0; var $num_queries = 0; - var $last_query_text = ""; + var $open_queries = array(); - // - // Constructor - // - function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true) + var $last_query_text = ''; + + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) { $this->persistency = $persistency; $this->user = $sqluser; - $this->password = $sqlpassword; - $this->server = $sqlserver; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; + + $this->db_connect_id = ($this->persistency) ? @ociplogon($this->user, $sqlpassword, $this->server) : @ocinlogon($this->user, $sqlpassword, $this->server); - if($this->persistency) - { - $this->db_connect_id = @OCIPLogon($this->user, $this->password, $this->server); - } - else - { - $this->db_connect_id = @OCINLogon($this->user, $this->password, $this->server); - } - if($this->db_connect_id) - { - return $this->db_connect_id; - } - else - { - return false; - } + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } // @@ -65,320 +49,374 @@ class sql_db // function sql_close() { - if($this->db_connect_id) + if (!$this->db_connect_id) { - // Commit outstanding transactions - if($this->in_transaction) - { - OCICommit($this->db_connect_id); - } + return false; + } - if($this->query_result) + if ($this->transaction) + { + @ocicommit($this->db_connect_id); + } + + if (sizeof($this->open_queries)) + { + foreach ($this->open_queries as $i_query_id => $query_id) { - @OCIFreeStatement($this->query_result); + @ocifreestatement($query_id); } - $result = @OCILogoff($this->db_connect_id); - return $result; } - else + + return @ocilogoff($this->db_connect_id); + } + + function sql_return_on_error($fail = false) + { + $this->return_on_error = $fail; + } + + function sql_num_queries() + { + return $this->num_queries; + } + + function sql_transaction($status = 'begin') + { + switch ($status) { - return false; + case 'begin': + $result = true; + $this->transaction = true; + break; + + case 'commit': + $result = @ocicommit($this->db_connect_id); + $this->transaction = false; + + if (!$result) + { + @ocirollback($this->db_connect_id); + } + break; + + case 'rollback': + $result = @ocirollback($this->db_connect_id); + $this->transaction = false; + break; + + default: + $result = true; } + + return $result; } - // // Base query method - // - function sql_query($query = "", $transaction = FALSE) + function sql_query($query = '', $cache_ttl = 0) { - // Remove any pre-existing queries - unset($this->query_result); - - // Put us in transaction mode because with Oracle as soon as you make a query you're in a transaction - $this->in_transaction = TRUE; - - if($query != "") + if ($query != '') { - $this->last_query = $query; - $this->num_queries++; + global $cache; - if(eregi("LIMIT", $query)) + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) { - preg_match("/^(.*)LIMIT ([0-9]+)[, ]*([0-9]+)*/s", $query, $limits); + $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; + + if (!$this->query_result) + { + $this->num_queries++; - $query = $limits[1]; - if($limits[3]) + $in_transaction = false; + if (!$this->transaction) { - $row_offset = $limits[2]; - $num_rows = $limits[3]; + $this->sql_transaction('begin'); } else { - $row_offset = 0; - $num_rows = $limits[2]; + $in_transaction = true; } - } - if(eregi("^(INSERT|UPDATE) ", $query)) - { - $query = preg_replace("/\\\'/s", "''", $query); - } + $this->query_result = @ociparse($this->db_connect_id, $query); + $success = @ociexecute($this->query_result, OCI_DEFAULT); - $this->query_result = @OCIParse($this->db_connect_id, $query); - $success = @OCIExecute($this->query_result, OCI_DEFAULT); - } - if($success) - { - if($transaction == END_TRANSACTION) + if (!$success) + { + $this->sql_error($query); + $this->query_result = false; + } + else + { + if (!$in_transaction) + { + $this->sql_transaction('commit'); + } + } + + 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') !== false && $this->query_result) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG_EXTRA')) { - OCICommit($this->db_connect_id); - $this->in_transaction = FALSE; + $this->sql_report('fromcache', $query); } - - unset($this->row[$this->query_result]); - unset($this->rowset[$this->query_result]); - $this->last_query_text[$this->query_result] = $query; - - return $this->query_result; } else { - if($this->in_transaction) - { - OCIRollback($this->db_connect_id); - } return false; } + + return ($this->query_result) ? $this->query_result : false; } - // - // Other query methods - // - function sql_numrows($query_id = 0) - { - if(!$query_id) - { - $query_id = $this->query_result; - } - if($query_id) + function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + if ($query != '') { - $result = @OCIFetchStatement($query_id, $this->rowset); - // OCIFetchStatment kills our query result so we have to execute the statment again - // if we ever want to use the query_id again. - @OCIExecute($query_id, OCI_DEFAULT); - return $result; - } - else - { - return false; - } + $this->query_result = false; + + $query = 'SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (' . $query . ') a WHERE rownum <= ' . ($offset + $total) . ') WHERE xrownum >= ' . $offset; + + return $this->sql_query($query, $cache_ttl); + } + else + { + return false; + } } - function sql_affectedrows($query_id = 0) + + // Idea for this from Ikonboard + function sql_build_array($query, $assoc_ary = false) { - if(!$query_id) + if (!is_array($assoc_ary)) { - $query_id = $this->query_result; + return false; } - if($query_id) + + $fields = array(); + $values = array(); + if ($query == 'INSERT') { - $result = @OCIRowCount($query_id); - return $result; + foreach ($assoc_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + elseif (is_string($var)) + { + $values[] = "'" . $this->sql_escape($var) . "'"; + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; } - else + else if ($query == 'UPDATE' || $query == 'SELECT') { - return false; + $values = array(); + foreach ($assoc_ary as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + elseif (is_string($var)) + { + $values[] = "$key = '" . $this->sql_escape($var) . "'"; + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values); } + + return $query; } - function sql_numfields($query_id = 0) + + // Other query methods + // + // NOTE :: Want to remove _ALL_ reliance on sql_numrows from core code ... + // don't want this here by a middle Milestone + function sql_numrows($query_id = false) { - if(!$query_id) + if (!$query_id) { $query_id = $this->query_result; } - if($query_id) - { - $result = @OCINumCols($query_id); - return $result; - } - else - { - return false; - } + + $result = @ocifetchstatement($query_id, $this->rowset); + // OCIFetchStatment kills our query result so we have to execute the statment again + // if we ever want to use the query_id again. + @ociexecute($query_id, OCI_DEFAULT); + + return $result; } - function sql_fieldname($offset, $query_id = 0) + + function sql_affectedrows() { - // OCIColumnName uses a 1 based array so we have to up the offset by 1 in here to maintain - // full abstraction compatibitly - $offset += 1; - if(!$query_id) - { - $query_id = $this->query_result; - } - if($query_id) - { - $result = strtolower(@OCIColumnName($query_id, $offset)); - return $result; - } - else - { - return false; - } + $query_id = $this->query_result; + + return ($query_id) ? @ocirowcount($query_id) : false; } - function sql_fieldtype($offset, $query_id = 0) + + function sql_fetchrow($query_id = false) { - // This situation is the same as fieldname - $offset += 1; - if(!$query_id) + global $cache; + + if (!$query_id) { $query_id = $this->query_result; } - if($query_id) + + if (isset($cache->sql_rowset[$query_id])) { - $result = @OCIColumnType($query_id, $offset); - return $result; + return $cache->sql_fetchrow($query_id); } - else + + $row = array(); + $result = @ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + + if (!$result || !$row) { return false; } - } - function sql_fetchrow($query_id = 0, $debug = FALSE) - { - if(!$query_id) - { - $query_id = $this->query_result; - } - if($query_id) - { - $result_row = ""; - $result = @OCIFetchInto($query_id, $result_row, OCI_ASSOC+OCI_RETURN_NULLS); - if($debug) - { - echo "Query was: ".$this->last_query . "<br>"; - echo "Result: $result<br>"; - echo "Query ID: $query_id<br>"; - echo "<pre>"; - var_dump($result_row); - echo "</pre>"; - } - if($result_row == "") - { - return false; - } - for($i = 0; $i < count($result_row); $i++) + $result_row = array(); + foreach ($row as $key => $value) + { + // OCI->CLOB? + if (is_object($value)) { - list($key, $val) = each($result_row); - $return_arr[strtolower($key)] = $val; + $value = ($value->size()) ? $value->read($value->size()) : ''; } - $this->row[$query_id] = $return_arr; - - return $this->row[$query_id]; - } - else - { - return false; + + $result_row[strtolower($key)] = $value; } + $this->row[$query_id] = $result_row; + + return $this->row[$query_id]; } - // This function probably isn't as efficant is it could be but any other way I do it - // I end up losing 1 row... - function sql_fetchrowset($query_id = 0) + + function sql_fetchrowset($query_id = false) { - if(!$query_id) + if (!$query_id) { $query_id = $this->query_result; } - if($query_id) + + if ($query_id) { - $rows = @OCIFetchStatement($query_id, $results); - @OCIExecute($query_id, OCI_DEFAULT); - for($i = 0; $i <= $rows; $i++) - { - @OCIFetchInto($query_id, $tmp_result, OCI_ASSOC+OCI_RETURN_NULLS); + unset($this->rowset[$query_id]); + unset($this->row[$query_id]); - for($j = 0; $j < count($tmp_result); $j++) - { - list($key, $val) = each($tmp_result); - $return_arr[strtolower($key)] = $val; - } - $result[] = $return_arr; + $result = array(); + while ($this->rowset[$query_id] = $this->sql_fetchrow($query_id)) + { + $result[] = $this->rowset[$query_id]; } return $result; } - else - { - return false; - } + + return false; } - function sql_fetchfield($field, $rownum = -1, $query_id = 0) + + function sql_fetchfield($field, $rownum = -1, $query_id = false) { - if(!$query_id) + if (!$query_id) { $query_id = $this->query_result; } - if($query_id) + + if ($query_id) { - if($rownum > -1) + if ($rownum > -1) { // Reset the internal rownum pointer. - @OCIExecute($query_id, OCI_DEFAULT); - for($i = 0; $i < $rownum; $i++) - { - // Move the interal pointer to the row we want - @OCIFetch($query_id); - } + @ociexecute($query_id, OCI_DEFAULT); + for ($i = 0; $i < $rownum; $i++) + { + // Move the interal pointer to the row we want + @ocifetch($query_id); + } + // Get the field data. - $result = @OCIResult($query_id, strtoupper($field)); + $result = @ociresult($query_id, strtoupper($field)); } else { // The internal pointer should be where we want it // so we just grab the field out of the current row. - $result = @OCIResult($query_id, strtoupper($field)); + $result = @ociresult($query_id, strtoupper($field)); } + return $result; } - else - { - return false; - } + + return false; } - function sql_rowseek($rownum, $query_id = 0) + + function sql_rowseek($rownum, $query_id = false) { - if(!$query_id) + if (!$query_id) { - $query_id = $this->query_result; + $query_id = $this->query_result; } - if($query_id) + + if ($query_id) { - @OCIExecute($query_id, OCI_DEFAULT); - for($i = 0; $i < $rownum; $i++) - { - @OCIFetch($query_id); - } - $result = @OCIFetch($query_id); + @ociexecute($query_id, OCI_DEFAULT); + + for ($i = 0; $i < $rownum; $i++) + { + @ocifetch($query_id); + } + $result = @ocifetch($query_id); + return $result; } - else - { - return false; - } + + return false; } - function sql_nextid($query_id = 0) + + function sql_nextid() { - if(!$query_id) - { - $query_id = $this->query_result; - } - if($query_id && $this->last_query_text[$query_id] != "") + $query_id = $this->query_result; + + if ($query_id && $this->last_query_text != '') { - if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename)) + if (preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text, $tablename)) { - $query = "SELECT ".$tablename[2]."_id_seq.currval FROM DUAL"; - $stmt = @OCIParse($this->db_connect_id, $query); - @OCIExecute($stmt,OCI_DEFAULT ); - $temp_result = @OCIFetchInto($stmt, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS); - if($temp_result) + $query = 'SELECT ' . $tablename[1] . '_id_seq.currval FROM DUAL'; + $stmt = @ociparse($this->db_connect_id, $query); + @ociexecute($stmt,OCI_DEFAULT ); + + $temp_result = @ocifetchinto($stmt, $temp_result, OCI_ASSOC + OCI_RETURN_NULLS); + + if ($temp_result) { return $temp_result['CURRVAL']; } @@ -387,80 +425,170 @@ class sql_db return false; } } - else - { - return false; - } - } - else - { - return false; } + + return false; } - function sql_nextid($query_id = 0) + function sql_freeresult($query_id = false) { - if(!$query_id) + if (!$query_id) { $query_id = $this->query_result; } - if($query_id && $this->last_query_text[$query_id] != "") - { - if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename)) - { - $query = "SELECT ".$tablename[2]."_id_seq.CURRVAL FROM DUAL"; - $temp_q_id = @OCIParse($this->db_connect_id, $query); - @OCIExecute($temp_q_id, OCI_DEFAULT); - @OCIFetchInto($temp_q_id, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS); - if($temp_result) - { - return $temp_result['CURRVAL']; - } - else - { - return false; - } - } - else - { - return false; - } - } - else + if (isset($this->open_queries[(int) $query_id])) { - return false; + unset($this->open_queries[(int) $query_id]); + return @ocifreestatement($query_id); } - } + return false; + } + function sql_escape($msg) + { + return str_replace("'", "''", str_replace('\\', '\\\\', $msg)); + } - function sql_freeresult($query_id = 0) + function sql_error($sql = '') { - if(!$query_id) + $error = @ocierror(); + $error = (!$error) ? @ocierror($this->query_result) : $error; + $error = (!$error) ? @ocierror($this->db_connect_id) : $error; + + if ($error) { - $query_id = $this->query_result; + $this->last_error_result = $error; } - if($query_id) + else { - $result = @OCIFreeStatement($query_id); - return $result; + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); } - else + + if (!$this->return_on_error) { - return false; + $this_page = (isset($_SERVER['PHP_SELF']) && !empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; + $this_page .= '&' . ((isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : (isset($_ENV['QUERY_STRING']) ? $_ENV['QUERY_STRING'] : '')); + + $message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']<br /><br /><u>CALLING PAGE</u><br /><br />' . htmlspecialchars($this_page) . (($sql != '') ? '<br /><br /><u>SQL</u><br /><br />' . $sql : '') . '<br />'; + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + + trigger_error($message, E_USER_ERROR); } + + return $error; } - function sql_error($query_id = 0) + + function sql_report($mode, $query = '') { - if(!$query_id) + if (empty($_GET['explain'])) { - $query_id = $this->query_result; + return; + } + + global $cache, $starttime, $phpbb_root_path; + static $curtime, $query_hold, $html_hold; + static $sql_report = ''; + static $cache_num_queries = 0; + + if (!$query && !empty($query_hold)) + { + $query = $query_hold; + } + + switch ($mode) + { + case 'display': + if (!empty($cache)) + { + $cache->unload(); + } + $this->sql_close(); + + $mtime = explode(' ', microtime()); + $totaltime = $mtime[0] + $mtime[1] - $starttime; + + echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'adm/subSilver.css" type="text/css"><style type="text/css">' . "\n"; + echo 'th { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic3.gif\') }' . "\n"; + echo 'td.cat { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic1.gif\') }' . "\n"; + echo '</style><title>' . $msg_title . '</title></head><body>'; + echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '"><img src="' . $phpbb_root_path . 'adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td><td width="100%" background="' . $phpbb_root_path . 'adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">SQL Report</span> </td></tr></table><br clear="all"/><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td height="40" align="center" valign="middle"><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . (($cache_num_queries) ? " + $cache_num_queries " . (($cache_num_queries == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></td></tr><tr><td align="center" nowrap="nowrap">Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></td></tr></table><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td>'; + echo $sql_report; + echo '</td></tr></table><br /></body></html>'; + exit; + break; + + case 'start': + $query_hold = $query; + $html_hold = ''; + + $curtime = explode(' ', microtime()); + $curtime = $curtime[0] + $curtime[1]; + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @ociparse($this->db_connect_id, $query); + $success = @ociexecute($result, OCI_DEFAULT); + $row = array(); + + while ($void = @ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + // Take the time spent on parsing rows into account + } + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $time_cache = $endtime - $curtime; + $time_db = $splittime - $endtime; + $color = ($time_db > $time_cache) ? 'green' : 'red'; + + $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query results obtained from the cache</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></table><p align="center">'; + + $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', ($time_cache)) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p>'; + + // Pad the start time to not interfere with page timing + $starttime += $time_db; + + @ocifreestatement($result); + $cache_num_queries++; + break; + + case 'stop': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query #' . $this->num_queries . '</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></table> ' . $html_hold . '<p align="center">'; + + if ($this->query_result) + { + if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) + { + $sql_report .= "Affected rows: <b>" . $this->sql_affectedrows($this->query_result) . '</b> | '; + } + $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $curtime) . 's</b>'; + } + else + { + $error = $this->sql_error(); + $sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']); + } + + $sql_report .= '</p>'; + + $this->sql_time += $endtime - $curtime; + break; } - $result = @OCIError($query_id); - return $result; } + } // class sql_db } // if ... define diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 00d80ac4db..d74a535cea 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -11,10 +11,10 @@ /** * @ignore */ -if (!defined("SQL_LAYER")) +if (!defined('SQL_LAYER')) { -define("SQL_LAYER","sqlite"); +define('SQL_LAYER', 'sqlite'); /** * @package dbal_sqlite @@ -26,24 +26,30 @@ class sql_db var $query_result; var $return_on_error = false; var $transaction = false; - var $sql_report = ''; var $sql_time = 0; var $num_queries = 0; - var $open_queries = array(); - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port, $persistency = false) + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) { $this->persistency = $persistency; $this->user = $sqluser; $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; - $this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0, $error) : @sqlite_open($this->server, 0, $error); + $error = ''; + $this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0666, $error) : @sqlite_open($this->server, 0666, $error); - return ($this->db_connect_id) ? true : $error; + if ($this->db_connect_id) + { + @sqlite_query('PRAGMA short_column_names = 1', $this->db_connect_id); + } + + return ($this->db_connect_id) ? true : array('message' => $error); } + // // Other base methods + // function sql_close() { if (!$this->db_connect_id) @@ -69,18 +75,23 @@ class sql_db switch ($status) { case 'begin': - $this->transaction = true; $result = @sqlite_query('BEGIN', $this->db_connect_id); + $this->transaction = true; break; case 'commit': - $this->transaction = false; $result = @sqlite_query('COMMIT', $this->db_connect_id); + $this->transaction = false; + + if (!$result) + { + @sqlite_query('ROLLBACK', $this->db_connect_id); + } break; case 'rollback': - $this->transaction = false; $result = @sqlite_query('ROLLBACK', $this->db_connect_id); + $this->transaction = false; break; default: @@ -91,91 +102,44 @@ class sql_db } // Base query method - function sql_query($query = '', $expire_time = 0) + function sql_query($query = '', $cache_ttl = 0) { if ($query != '') { global $cache; - $query = preg_replace('#FROM \((.*?)\)(,|[\n\t ]+?WHERE) #s', 'FROM \1\2 ', $query); + $query = preg_replace('#FROM \((.*?)\)(,|[\n\r\t ]+?WHERE) #s', 'FROM \1\2 ', $query); - if (!$expire_time || !$cache->sql_load($query, $expire_time)) + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) { - if ($expire_time) - { - $cache_result = true; - } - - $this->query_result = false; - $this->num_queries++; + $this->sql_report('start', $query); + } - if (!empty($_GET['explain'])) - { - global $starttime; + $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; - $curtime = explode(' ', microtime()); - $curtime = $curtime[0] + $curtime[1] - $starttime; - } + if (!$this->query_result) + { + $this->num_queries++; - if (!($this->query_result = @sqlite_query($query, $this->db_connect_id))) + if (($this->query_result = @sqlite_query($query, $this->db_connect_id)) === false) { $this->sql_error($query); } - if (!empty($_GET['explain'])) + if (defined('DEBUG_EXTRA')) { - $endtime = explode(' ', microtime()); - $endtime = $endtime[0] + $endtime[1] - $starttime; - - $this->sql_report .= "<pre>Query:\t" . htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n\t", $query)) . "\n\n"; - - if ($this->query_result) - { - $this->sql_report .= "Time before: $curtime\nTime after: $endtime\nElapsed time: <b>" . ($endtime - $curtime) . "</b>\n</pre>"; - } - else - { - $error = $this->sql_error(); - $this->sql_report .= '<b>FAILED</b> - SQLite ' . $error['code'] . ': ' . htmlspecialchars($error['message']) . '<br><br><pre>'; - } - - $this->sql_time += $endtime - $curtime; - - if (preg_match('#^SELECT#', $query)) - { - $html_table = FALSE; - if ($result = @sqlite_query("EXPLAIN $query", $this->db_connect_id)) - { - while ($row = @sqlite_fetch_array($result, @sqlite_ASSOC)) - { - if (!$html_table && sizeof($row)) - { - $html_table = TRUE; - $this->sql_report .= "<table width=100% border=1 cellpadding=2 cellspacing=1>\n"; - $this->sql_report .= "<tr>\n<td><b>" . implode("</b></td>\n<td><b>", array_keys($row)) . "</b></td>\n</tr>\n"; - } - $this->sql_report .= "<tr>\n<td>" . implode(" </td>\n<td>", array_values($row)) . " </td>\n</tr>\n"; - } - } - - if ($html_table) - { - $this->sql_report .= '</table><br>'; - } - } - - $this->sql_report .= "<hr>\n"; + $this->sql_report('stop', $query); } - if (preg_match('#^SELECT#', $query)) + if ($cache_ttl && method_exists($cache, 'sql_save')) { - $this->open_queries[] = $this->query_result; + $cache->sql_save($query, $this->query_result, $cache_ttl); } } - - if (!empty($cache_result)) + else if (defined('DEBUG_EXTRA')) { - $cache->sql_save($query, $this->query_result); + $this->sql_report('fromcache', $query); } } else @@ -186,20 +150,26 @@ class sql_db return ($this->query_result) ? $this->query_result : false; } - function sql_query_limit($query, $total, $offset = 0, $expire_time = 0) - { - if ($query != '') + function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + if ($query != '') { - $this->query_result = false; + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = -1; + } - $query .= ' LIMIT ' . ((!empty($offset)) ? $total . ' OFFSET ' . $offset : $total); + $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total); - return $this->sql_query($query, $expire_time); - } - else - { - return false; - } + return $this->sql_query($query, $cache_ttl); + } + else + { + return false; + } } // Idea for this from Ikonboard @@ -234,7 +204,7 @@ class sql_db $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; } - else if ($query == 'UPDATE') + else if ($query == 'UPDATE' || $query == 'SELECT') { $values = array(); foreach ($assoc_ary as $key => $var) @@ -252,7 +222,7 @@ class sql_db $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; } } - $query = implode(', ', $values); + $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values); } return $query; @@ -277,7 +247,7 @@ class sql_db return ($this->db_connect_id) ? @sqlite_changes($this->db_connect_id) : false; } - function sql_fetchrow($query_id = 0) + function sql_fetchrow($query_id = false) { global $cache; @@ -286,15 +256,15 @@ class sql_db $query_id = $this->query_result; } - if ($cache->sql_exists($query_id)) + if (isset($cache->sql_rowset[$query_id])) { return $cache->sql_fetchrow($query_id); } - return ($query_id) ? @sqlite_fetch_array($query_id, @sqlite_ASSOC) : false; + return ($query_id) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false; } - function sql_fetchrowset($query_id = 0) + function sql_fetchrowset($query_id = false) { if (!$query_id) { @@ -305,19 +275,19 @@ class sql_db { unset($this->rowset[$query_id]); unset($this->row[$query_id]); - while ($this->rowset[$query_id] = @sqlite_fetch_array($query_id, @sqlite_ASSOC)) + + $result = array(); + while ($this->rowset[$query_id] = $this->sql_fetchrow($query_id)) { $result[] = $this->rowset[$query_id]; } return $result; } - else - { - return false; - } + + return false; } - function sql_fetchfield($field, $rownum = -1, $query_id = 0) + function sql_fetchfield($field, $rownum = -1, $query_id = false) { if (!$query_id) { @@ -326,11 +296,22 @@ class sql_db if ($query_id) { - return ($rownum > -1) ? ((@sqlite_seek($query_id, $rownum)) ? @sqlite_column($query_id, $field) : false) : @sqlite_column($query_id, $field); + if ($rownum > -1) + { + $result = (@sqlite_seek($query_id, $rownum)) ? @sqlite_column($query_id, $field) : false; + } + else + { + $result = @sqlite_column($query_id, $field); + } + + return $result; } + + return false; } - function sql_rowseek($rownum, $query_id = 0) + function sql_rowseek($rownum, $query_id = false) { if (!$query_id) { @@ -359,8 +340,8 @@ class sql_db { if (!$this->return_on_error) { - $this_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; - $this_page .= '&' . ((!empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : $_ENV['QUERY_STRING']); + $this_page = (isset($_SERVER['PHP_SELF']) && !empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; + $this_page .= '&' . ((isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : (isset($_ENV['QUERY_STRING']) ? $_ENV['QUERY_STRING'] : '')); $message = '<u>SQL ERROR</u> [ ' . SQL_LAYER . ' ]<br /><br />' . @sqlite_error_string(@sqlite_last_error($this->db_connect_id)) . '<br /><br /><u>CALLING PAGE</u><br /><br />' . htmlspecialchars($this_page) . (($sql != '') ? '<br /><br /><u>SQL</u><br /><br />' . $sql : '') . '<br />'; @@ -380,6 +361,106 @@ class sql_db return $result; } + function sql_report($mode, $query = '') + { + if (empty($_GET['explain'])) + { + return; + } + + global $cache, $starttime, $phpbb_root_path; + static $curtime, $query_hold, $html_hold; + static $sql_report = ''; + static $cache_num_queries = 0; + + if (!$query && !empty($query_hold)) + { + $query = $query_hold; + } + + switch ($mode) + { + case 'display': + if (!empty($cache)) + { + $cache->unload(); + } + $this->sql_close(); + + $mtime = explode(' ', microtime()); + $totaltime = $mtime[0] + $mtime[1] - $starttime; + + echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'adm/subSilver.css" type="text/css"><style type="text/css">' . "\n"; + echo 'th { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic3.gif\') }' . "\n"; + echo 'td.cat { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic1.gif\') }' . "\n"; + echo '</style><title>' . $msg_title . '</title></head><body>'; + echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '"><img src="' . $phpbb_root_path . 'adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td><td width="100%" background="' . $phpbb_root_path . 'adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">SQL Report</span> </td></tr></table><br clear="all"/><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td height="40" align="center" valign="middle"><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . (($cache_num_queries) ? " + $cache_num_queries " . (($cache_num_queries == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></td></tr><tr><td align="center" nowrap="nowrap">Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></td></tr></table><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td>'; + echo $sql_report; + echo '</td></tr></table><br /></body></html>'; + exit; + break; + + case 'start': + $query_hold = $query; + $html_hold = ''; + + $curtime = explode(' ', microtime()); + $curtime = $curtime[0] + $curtime[1]; + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @sqlite_query($query, $this->db_connect_id); + while ($void = @sqlite_fetch_array($result, SQLITE_ASSOC)) + { + // Take the time spent on parsing rows into account + } + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $time_cache = $endtime - $curtime; + $time_db = $splittime - $endtime; + $color = ($time_db > $time_cache) ? 'green' : 'red'; + + $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query results obtained from the cache</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></table><p align="center">'; + + $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', ($time_cache)) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p>'; + + // Pad the start time to not interfere with page timing + $starttime += $time_db; + + $cache_num_queries++; + break; + + case 'stop': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query #' . $this->num_queries . '</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></table> ' . $html_hold . '<p align="center">'; + + if ($this->query_result) + { + if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) + { + $sql_report .= "Affected rows: <b>" . $this->sql_affectedrows($this->query_result) . '</b> | '; + } + $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $curtime) . 's</b>'; + } + else + { + $error = $this->sql_error(); + $sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']); + } + + $sql_report .= '</p>'; + + $this->sql_time += $endtime - $curtime; + break; + } + } + } // class sql_db } // if ... define diff --git a/phpBB/install/install.php b/phpBB/install/install.php index 2980c9eef1..cebc7097f9 100644 --- a/phpBB/install/install.php +++ b/phpBB/install/install.php @@ -123,8 +123,8 @@ $available_dbms = array( 'oracle' => array( 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', - 'MODULE' => 'oracle', - 'DELIM' => '', + 'MODULE' => 'oci8', + 'DELIM' => '/', 'COMMENTS' => 'remove_comments' ), 'postgres' => array( @@ -1050,7 +1050,6 @@ if ($stage == 3) // NOTE: trigger_error does not work here. $db->return_on_error = true; - // Ok we have the db info go ahead and read in the relevant schema // and work on building the table $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; @@ -1076,7 +1075,6 @@ if ($stage == 3) } unset($sql_query); - // Ok tables have been built, let's fill in the basic information $sql_query = fread(fopen('schemas/schema_data.sql', 'r'), filesize('schemas/schema_data.sql')); @@ -1403,6 +1401,7 @@ function connect_check_db($error_connect, &$error, &$dbms, &$table_prefix, &$dbh case 'mysql': case 'mysql4': case 'mysqli': + case 'sqlite': $sql = "SHOW TABLES"; $field = "Tables_in_{$dbname}"; break; @@ -1430,6 +1429,11 @@ function connect_check_db($error_connect, &$error, &$dbms, &$table_prefix, &$dbh AND rdb$system_flag = 0'; $field = 'rdb$relation_name'; break; + + case 'oracle': + $sql = 'SELECT table_name FROM USER_TABLES'; + $field = 'table_name'; + break; } $result = $db->sql_query($sql); @@ -1442,7 +1446,7 @@ function connect_check_db($error_connect, &$error, &$dbms, &$table_prefix, &$dbh { // All phpBB installations will at least have config else it won't // work - if (in_array($row[$field], $table_ary)) + if (in_array(strtolower($row[$field]), $table_ary)) { $error['db'][] = $lang['INST_ERR_PREFIX']; break; diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 308a749078..20ee281c7c 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1,5 +1,5 @@ # -# phpbb - Firebird schema +# Firebird Schema for phpBB 3.x - (c) phpBB Group, 2005 # # $Id$ # diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 7d7c119345..0881335fe8 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1,8 +1,8 @@ /* - mssql_schema.sql for phpBB2 (c) 2001, phpBB Group +MSSQL Schema for phpBB 3.x - (c) phpBB Group, 2005 - $Id$ +$Id$ */ diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index 96cc06fb5d..d0a292280d 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -1,5 +1,5 @@ # -# phpbb - MySQL schema - phpBB 2.2 (c) phpBB Group, 2003 +# MySQL Schema for phpBB 3.x - (c) phpBB Group, 2005 # # $Id$ # @@ -594,7 +594,7 @@ CREATE TABLE phpbb_sessions ( session_start int(11) DEFAULT '0' NOT NULL, session_time int(11) DEFAULT '0' NOT NULL, session_ip varchar(40) DEFAULT '0' NOT NULL, - session_browser varchar(100) DEFAULT '' NULL, + session_browser varchar(100) DEFAULT '' NOT NULL, session_page varchar(100) DEFAULT '' NOT NULL, session_viewonline tinyint(1) DEFAULT '1' NOT NULL, session_admin tinyint(1) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 9cb1317e4e..3bb1ef88d2 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1,5 +1,5 @@ /* - phpBB2 Oracle 8i DB schema - (c) 2001 The phpBB Group + Oracle Schema for phpBB 3.x - (c) phpBB Group, 2005 $Id$ */ @@ -14,23 +14,27 @@ */ /* -CREATE TABLESPACE phpbb - DATAFILE 'E:/web/Oracle8i/ORADATA/phpbb01.dbf' +CREATE TABLESPACE "PHPBB" + LOGGING + DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' SIZE 10M AUTOEXTEND ON NEXT 10M MAXSIZE 100M; -CREATE USER phpbb - IDENTIFIED BY phpbb_password - DEFAULT TABLESPACE phpbb - TEMPORARY TABLESPACE temp; - -GRANT CREATE SESSION TO phpbb; -GRANT CREATE TABLE TO phpbb; -GRANT CREATE SEQUENCE TO phpbb; -GRANT CREATE TRIGGER TO phpbb; - -ALTER USER phpbb QUOTA unlimited ON phpbb; +CREATE USER "PHPBB" + PROFILE "DEFAULT" + IDENTIFIED BY "phpbb_password" + DEFAULT TABLESPACE "PHPBB" + QUOTA UNLIMITED ON "PHPBB" + ACCOUNT UNLOCK; + +GRANT ANALYZE ANY TO "PHPBB"; +GRANT CREATE SEQUENCE TO "PHPBB"; +GRANT CREATE SESSION TO "PHPBB"; +GRANT CREATE TABLE TO "PHPBB"; +GRANT CREATE TRIGGER TO "PHPBB"; +GRANT CREATE VIEW TO "PHPBB"; +GRANT "CONNECT" TO "PHPBB"; COMMIT; DISCONNECT; @@ -38,694 +42,1697 @@ DISCONNECT; CONNECT phpbb/phpbb_password; */ +CREATE TABLE phpbb_attachments ( + attach_id number(8) NOT NULL, + post_msg_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + in_message number(1) DEFAULT '0' NOT NULL, + poster_id number(8) DEFAULT '0' NOT NULL, + physical_filename varchar2(255), + real_filename varchar2(255), + download_count number(8) DEFAULT '0' NOT NULL, + comment_ varchar2(255), + extension varchar2(100), + mimetype varchar2(100), + filesize number(20) NOT NULL, + filetime number(11) DEFAULT '0' NOT NULL, + thumbnail number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_attachments PRIMARY KEY (attach_id) +) +/ +CREATE SEQUENCE sq_phpbb_attachments_attach_id +/ -CREATE SEQUENCE phpbb_banlist_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_categories_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_config_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_disallow_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_forums_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_posts_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_privmsgs_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_ranks_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_smilies_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_themes_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_topics_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_users_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_words_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_groups_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_forum_prune_id_seq increment by 1 start with 2 minvalue 0; -CREATE SEQUENCE phpbb_vote_desc_id_seq increment by 1 start with 2 minvalue 0; - - -/* -------------------------------------------------------- - Table structure for table phpbb_auth_access --------------------------------------------------------- */ -CREATE TABLE phpbb_auth_access ( - group_id number(4) DEFAULT '0' NOT NULL, - forum_id number(4) DEFAULT '0' NOT NULL, - auth_view number(4) DEFAULT '0' NOT NULL, - auth_read number(4) DEFAULT '0' NOT NULL, - auth_post number(4) DEFAULT '0' NOT NULL, - auth_reply number(4) DEFAULT '0' NOT NULL, - auth_edit number(4) DEFAULT '0' NOT NULL, - auth_delete number(4) DEFAULT '0' NOT NULL, - auth_announce number(4) DEFAULT '0' NOT NULL, - auth_sticky number(4) DEFAULT '0' NOT NULL, - auth_pollcreate number(4) DEFAULT '0' NOT NULL, - auth_attachments number(4) DEFAULT '0' NOT NULL, - auth_vote number(4) DEFAULT '0' NOT NULL, - auth_mod number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_auth_access_pkey PRIMARY KEY (group_id) -); -CREATE INDEX group_phpbb_auth_access_index ON phpbb_auth_access (forum_id); - - -/* -------------------------------------------------------- - Table structure for table phpbb_groups --------------------------------------------------------- */ -CREATE TABLE phpbb_groups ( - group_id number(4) NOT NULL, - group_name varchar(40) NOT NULL, - group_type number(2) DEFAULT '1' NOT NULL, - group_description varchar(255) NOT NULL, - group_moderator number(4) DEFAULT '0' NOT NULL, - group_single_user number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id) -); - -/* -------------------------------------------------------- - Table structure for table phpbb_banlist --------------------------------------------------------- */ +CREATE OR REPLACE TRIGGER ai_phpbb_attachments_attach_id +BEFORE INSERT ON phpbb_attachments +FOR EACH ROW WHEN ( + new.attach_id IS NULL OR new.attach_id = 0 +) +BEGIN + SELECT sq_phpbb_attachments_attach_id.nextval + INTO :new.attach_id + FROM dual; +END; +/ + +CREATE INDEX filetime on phpbb_attachments (filetime) +/ +CREATE INDEX post_msg_id on phpbb_attachments (post_msg_id) +/ +CREATE INDEX topic_id on phpbb_attachments (topic_id) +/ +CREATE INDEX poster_id on phpbb_attachments (poster_id) +/ +CREATE INDEX physical_filename on phpbb_attachments (physical_filename) +/ +CREATE INDEX filesize on phpbb_attachments (filesize) +/ + +/* + Table: phpbb_auth_groups +*/ +CREATE TABLE phpbb_auth_groups ( + group_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(5) DEFAULT '0' NOT NULL, + auth_setting number(4) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX group_id on phpbb_auth_groups (group_id) +/ +CREATE INDEX auth_option_id on phpbb_auth_groups (auth_option_id) +/ + +/* + Table: phpbb_auth_options +*/ +CREATE TABLE phpbb_auth_options ( + auth_option_id number(5) NOT NULL, + auth_option varchar2(20), + is_global number(1) DEFAULT '0' NOT NULL, + is_local number(1) DEFAULT '0' NOT NULL, + founder_only number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_auth_options PRIMARY KEY (auth_option_id) +) +/ + +CREATE SEQUENCE sq_phpbb_auth_options_auth_opt +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_auth_options_auth_opt +BEFORE INSERT ON phpbb_auth_options +FOR EACH ROW WHEN ( + new.auth_option_id IS NULL OR new.auth_option_id = 0 +) +BEGIN + SELECT sq_phpbb_auth_options_auth_opt.nextval + INTO :new.auth_option_id + FROM dual; +END; +/ + +CREATE INDEX auth_option on phpbb_auth_options (auth_option) +/ + +/* + Table: phpbb_auth_presets +*/ +CREATE TABLE phpbb_auth_presets ( + preset_id number(4) NOT NULL, + preset_name varchar2(50) DEFAULT '', + preset_user_id number(5) DEFAULT '0' NOT NULL, + preset_type varchar2(2) DEFAULT '', + preset_data clob DEFAULT '', + CONSTRAINT pk_phpbb_auth_presets PRIMARY KEY (preset_id) +) +/ + +CREATE SEQUENCE sq_phpbb_auth_presets_preset_i +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_auth_presets_preset_i +BEFORE INSERT ON phpbb_auth_presets +FOR EACH ROW WHEN ( + new.preset_id IS NULL OR new.preset_id = 0 +) +BEGIN + SELECT sq_phpbb_auth_presets_preset_i.nextval + INTO :new.preset_id + FROM dual; +END; +/ + +CREATE INDEX preset_type on phpbb_auth_presets (preset_type) +/ + +/* + Table: phpbb_auth_users +*/ +CREATE TABLE phpbb_auth_users ( + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(5) DEFAULT '0' NOT NULL, + auth_setting number(4) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX user_id on phpbb_auth_users (user_id) +/ +CREATE INDEX auth_option_id02 on phpbb_auth_users (auth_option_id) +/ + +/* + Table: phpbb_banlist +*/ CREATE TABLE phpbb_banlist ( - ban_id number(4) NOT NULL, - ban_userid number(4), - ban_ip char(8), - ban_email varchar(255), - CONSTRAINT phpbb_banlist_pkey PRIMARY KEY (ban_id) -); -CREATE INDEX ban_userid_phpbb_banlist_index ON phpbb_banlist (ban_userid); - - -/* -------------------------------------------------------- - Table structure for table phpbb_categories --------------------------------------------------------- */ -CREATE TABLE phpbb_categories ( - cat_id number(4) NOT NULL, - cat_title varchar(100), - cat_order number(4), - CONSTRAINT phpbb_categories_pkey PRIMARY KEY (cat_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_config --------------------------------------------------------- */ + ban_id number(8) NOT NULL, + ban_userid number(8) DEFAULT '0' NOT NULL, + ban_ip varchar2(40) DEFAULT '', + ban_email varchar2(50) DEFAULT '', + ban_start number(11) DEFAULT '0' NOT NULL, + ban_end number(11) DEFAULT '0' NOT NULL, + ban_exclude number(1) DEFAULT '0' NOT NULL, + ban_reason varchar2(255) DEFAULT '', + ban_give_reason varchar2(255) DEFAULT '', + CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id) +) +/ + +CREATE SEQUENCE sq_phpbb_banlist_ban_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_banlist_ban_id +BEFORE INSERT ON phpbb_banlist +FOR EACH ROW WHEN ( + new.ban_id IS NULL OR new.ban_id = 0 +) +BEGIN + SELECT sq_phpbb_banlist_ban_id.nextval + INTO :new.ban_id + FROM dual; +END; +/ + +/* + Table: phpbb_bbcodes +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id number(3) DEFAULT '0' NOT NULL, + bbcode_tag varchar2(16) DEFAULT '', + bbcode_match varchar2(255) DEFAULT '', + bbcode_tpl clob DEFAULT '', + first_pass_match varchar2(255) DEFAULT '', + first_pass_replace varchar2(255) DEFAULT '', + second_pass_match varchar2(255) DEFAULT '', + second_pass_replace clob DEFAULT '', + CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id) +) +/ + +/* + Table: phpbb_bookmarks +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + order_id number(8) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX order_id on phpbb_bookmarks (order_id) +/ +CREATE INDEX topic_user_id on phpbb_bookmarks (topic_id, user_id) +/ + +/* + Table: phpbb_bots +*/ +CREATE TABLE phpbb_bots ( + bot_id number(3) NOT NULL, + bot_active number(1) DEFAULT '1' NOT NULL, + bot_name varchar2(255) DEFAULT '', + user_id number(8) DEFAULT '0' NOT NULL, + bot_agent varchar2(255) DEFAULT '', + bot_ip varchar2(255) DEFAULT '', + CONSTRAINT pk_phpbb_bots PRIMARY KEY (bot_id) +) +/ + +CREATE SEQUENCE sq_phpbb_bots_bot_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_bots_bot_id +BEFORE INSERT ON phpbb_bots +FOR EACH ROW WHEN ( + new.bot_id IS NULL OR new.bot_id = 0 +) +BEGIN + SELECT sq_phpbb_bots_bot_id.nextval + INTO :new.bot_id + FROM dual; +END; +/ + +CREATE INDEX bot_active on phpbb_bots (bot_active) +/ + +/* + Table: phpbb_cache +*/ +CREATE TABLE phpbb_cache ( + var_name varchar2(255) DEFAULT '', + var_expires number(10) DEFAULT '0' NOT NULL, + var_data clob, + CONSTRAINT pk_phpbb_cache PRIMARY KEY (var_name) +) +/ + +/* + Table: phpbb_config +*/ CREATE TABLE phpbb_config ( - config_name varchar(255) NOT NULL, - config_value varchar(255), - CONSTRAINT phpbb_config_pkey PRIMARY KEY (config_name) -); + config_name varchar2(255), + config_value varchar2(255), + is_dynamic number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name) +) +/ + +CREATE INDEX is_dynamic on phpbb_config (is_dynamic) +/ +/* + Table: phpbb_confirm +*/ +CREATE TABLE phpbb_confirm ( + confirm_id varchar2(32) DEFAULT '', + session_id varchar2(32) DEFAULT '', + code varchar2(6) DEFAULT '', + CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) +) +/ -/* -------------------------------------------------------- - Table structure for table phpbb_disallow --------------------------------------------------------- */ +/* + Table: phpbb_disallow +*/ CREATE TABLE phpbb_disallow ( - disallow_id number(4) NOT NULL, - disallow_username varchar(25), - CONSTRAINT phpbb_disallow_pkey PRIMARY KEY (disallow_id) -); + disallow_id number(8) NOT NULL, + disallow_username varchar2(30) DEFAULT '', + CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id) +) +/ + +CREATE SEQUENCE sq_phpbb_disallow_disallow_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_disallow_disallow_id +BEFORE INSERT ON phpbb_disallow +FOR EACH ROW WHEN ( + new.disallow_id IS NULL OR new.disallow_id = 0 +) +BEGIN + SELECT sq_phpbb_disallow_disallow_id.nextval + INTO :new.disallow_id + FROM dual; +END; +/ + +/* + Table: phpbb_drafts +*/ +CREATE TABLE phpbb_drafts ( + draft_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + save_time number(11) DEFAULT '0' NOT NULL, + draft_subject varchar2(60), + draft_message clob DEFAULT '', + CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id) +) +/ +CREATE SEQUENCE sq_phpbb_drafts_draft_id +/ -/* -------------------------------------------------------- - Table structure for table phpbb_forums --------------------------------------------------------- */ +CREATE OR REPLACE TRIGGER ai_phpbb_drafts_draft_id +BEFORE INSERT ON phpbb_drafts +FOR EACH ROW WHEN ( + new.draft_id IS NULL OR new.draft_id = 0 +) +BEGIN + SELECT sq_phpbb_drafts_draft_id.nextval + INTO :new.draft_id + FROM dual; +END; +/ + +CREATE INDEX save_time on phpbb_drafts (save_time) +/ + +/* + Table: phpbb_extensions +*/ +CREATE TABLE phpbb_extensions ( + extension_id number(8) NOT NULL, + group_id number(8) DEFAULT '0' NOT NULL, + extension varchar2(100) DEFAULT '', + CONSTRAINT pk_phpbb_extensions PRIMARY KEY (extension_id) +) +/ + +CREATE SEQUENCE sq_phpbb_extensions_extension_ +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_extensions_extension_ +BEFORE INSERT ON phpbb_extensions +FOR EACH ROW WHEN ( + new.extension_id IS NULL OR new.extension_id = 0 +) +BEGIN + SELECT sq_phpbb_extensions_extension_.nextval + INTO :new.extension_id + FROM dual; +END; +/ + +/* + Table: phpbb_extension_groups +*/ +CREATE TABLE phpbb_extension_groups ( + group_id number(8) NOT NULL, + group_name varchar2(20), + cat_id number(2) DEFAULT '0' NOT NULL, + allow_group number(1) DEFAULT '0' NOT NULL, + download_mode number(1) DEFAULT '1' NOT NULL, + upload_icon varchar2(100) DEFAULT '', + max_filesize number(20) DEFAULT '0' NOT NULL, + allowed_forums clob, + allow_in_pm number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id) +) +/ + +CREATE SEQUENCE sq_phpbb_extension_groups_grou +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_extension_groups_grou +BEFORE INSERT ON phpbb_extension_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT sq_phpbb_extension_groups_grou.nextval + INTO :new.group_id + FROM dual; +END; +/ + +/* + Table: phpbb_forums +*/ CREATE TABLE phpbb_forums ( - forum_id number(4) NOT NULL, - cat_id number(4), - forum_name varchar(150), - forum_desc varchar(2000), - forum_status number(4) DEFAULT '0' NOT NULL, - forum_order number(4) DEFAULT '1' NOT NULL, - forum_posts number(4) DEFAULT '0' NOT NULL, - forum_topics number(4) DEFAULT '0' NOT NULL, - forum_last_post_id number(4) DEFAULT '0' NOT NULL, - prune_enable number(4) DEFAULT '0' NOT NULL, - prune_next number(4), - auth_view number(4) DEFAULT '0' NOT NULL, - auth_read number(4) DEFAULT '0' NOT NULL, - auth_post number(4) DEFAULT '0' NOT NULL, - auth_reply number(4) DEFAULT '0' NOT NULL, - auth_edit number(4) DEFAULT '0' NOT NULL, - auth_delete number(4) DEFAULT '0' NOT NULL, - auth_announce number(4) DEFAULT '0' NOT NULL, - auth_sticky number(4) DEFAULT '0' NOT NULL, - auth_pollcreate number(4) DEFAULT '0' NOT NULL, - auth_vote number(4) DEFAULT '0' NOT NULL, - auth_attachments number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_forums_pkey PRIMARY KEY (forum_id) -); -CREATE INDEX cat_id_phpbb_forums_index ON phpbb_forums (cat_id); -CREATE INDEX forums_order_phpbb_forums ON phpbb_forums (forum_order); - - -/* -------------------------------------------------------- - Table structure for table phpbb_forum_prune --------------------------------------------------------- */ -CREATE TABLE phpbb_forum_prune ( - prune_id number(4) NOT NULL, - forum_id number(4) NOT NULL, - prune_days number(4) NOT NULL, - prune_freq number(4) NOT NULL, - CONSTRAINT phpbb_forum_prune_pkey PRIMARY KEY (prune_id) -); -CREATE INDEX forum_id_phpbb_forum_prune ON phpbb_forum_prune (forum_id); - - -/* -------------------------------------------------------- - Table structure for table phpbb_posts --------------------------------------------------------- */ + forum_id number(5) NOT NULL, + parent_id number(5) NOT NULL, + left_id number(5) NOT NULL, + right_id number(5) NOT NULL, + forum_parents clob, + forum_name varchar2(150), + forum_desc clob, + forum_link varchar2(200) DEFAULT '', + forum_password varchar2(32) DEFAULT '', + forum_style number(4), + forum_image varchar2(50) DEFAULT '', + forum_rules clob DEFAULT '', + forum_rules_link varchar2(200) DEFAULT '', + forum_rules_flags number(4) DEFAULT '0' NOT NULL, + forum_rules_bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + forum_rules_bbcode_uid varchar2(5) DEFAULT '', + forum_topics_per_page number(4) DEFAULT '0' NOT NULL, + forum_type number(4) DEFAULT '0' NOT NULL, + forum_status number(4) DEFAULT '0' NOT NULL, + forum_posts number(8) DEFAULT '0' NOT NULL, + forum_topics number(8) DEFAULT '0' NOT NULL, + forum_topics_real number(8) DEFAULT '0' NOT NULL, + forum_last_post_id number(8) DEFAULT '0' NOT NULL, + forum_last_poster_id number(8) DEFAULT '0' NOT NULL, + forum_last_post_time number(11) DEFAULT '0' NOT NULL, + forum_last_poster_name varchar2(30), + forum_flags number(4) DEFAULT '0' NOT NULL, + display_on_index number(1) DEFAULT '1' NOT NULL, + enable_indexing number(1) DEFAULT '1' NOT NULL, + enable_icons number(1) DEFAULT '1' NOT NULL, + enable_prune number(1) DEFAULT '0' NOT NULL, + prune_next number(11), + prune_days number(4) NOT NULL, + prune_viewed number(4) NOT NULL, + prune_freq number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id) +) +/ + +CREATE SEQUENCE sq_phpbb_forums_forum_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_forums_forum_id +BEFORE INSERT ON phpbb_forums +FOR EACH ROW WHEN ( + new.forum_id IS NULL OR new.forum_id = 0 +) +BEGIN + SELECT sq_phpbb_forums_forum_id.nextval + INTO :new.forum_id + FROM dual; +END; +/ + +CREATE INDEX left_right_id on phpbb_forums (left_id, right_id) +/ +CREATE INDEX forum_last_post_id on phpbb_forums (forum_last_post_id) +/ + +/* + Table: phpbb_forum_access +*/ +CREATE TABLE phpbb_forum_access ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + session_id varchar2(32) DEFAULT '', + CONSTRAINT pk_phpbb_forum_access PRIMARY KEY (forum_id, user_id, session_id) +) +/ + +/* + Table: phpbb_forums_marking +*/ +CREATE TABLE phpbb_forums_marking ( + user_id number(9) DEFAULT '0' NOT NULL, + forum_id number(9) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums_marking PRIMARY KEY (user_id, forum_id) +) +/ + +/* + Table: phpbb_forums_watch +*/ +CREATE TABLE phpbb_forums_watch ( + forum_id number(5) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + notify_status number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX forum_id on phpbb_forums_watch (forum_id) +/ +CREATE INDEX user_id02 on phpbb_forums_watch (user_id) +/ +CREATE INDEX notify_status on phpbb_forums_watch (notify_status) +/ + +/* + Table: phpbb_groups +*/ +CREATE TABLE phpbb_groups ( + group_id number(8) NOT NULL, + group_type number(4) DEFAULT '1' NOT NULL, + group_name varchar2(40) DEFAULT '', + group_display number(1) DEFAULT '0' NOT NULL, + group_avatar varchar2(100) DEFAULT '', + group_avatar_type number(4) DEFAULT '0' NOT NULL, + group_avatar_width number(4) DEFAULT '0' NOT NULL, + group_avatar_height number(4) DEFAULT '0' NOT NULL, + group_rank number(5) DEFAULT '1' NOT NULL, + group_colour varchar2(6) DEFAULT '', + group_sig_chars number(8) DEFAULT '0' NOT NULL, + group_receive_pm number(1) DEFAULT '0' NOT NULL, + group_message_limit number(8) DEFAULT '0' NOT NULL, + group_chgpass number(6) DEFAULT '0' NOT NULL, + group_description varchar2(255) DEFAULT '', + group_legend number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) +) +/ + +CREATE SEQUENCE sq_phpbb_groups_group_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_groups_group_id +BEFORE INSERT ON phpbb_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT sq_phpbb_groups_group_id.nextval + INTO :new.group_id + FROM dual; +END; +/ + +CREATE INDEX group_legend on phpbb_groups (group_legend) +/ + +/* + Table: phpbb_icons +*/ +CREATE TABLE phpbb_icons ( + icons_id number(4) NOT NULL, + icons_url varchar2(50), + icons_width number(4) NOT NULL, + icons_height number(4) NOT NULL, + icons_order number(4) NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id) +) +/ + +CREATE SEQUENCE sq_phpbb_icons_icons_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_icons_icons_id +BEFORE INSERT ON phpbb_icons +FOR EACH ROW WHEN ( + new.icons_id IS NULL OR new.icons_id = 0 +) +BEGIN + SELECT sq_phpbb_icons_icons_id.nextval + INTO :new.icons_id + FROM dual; +END; +/ + +/* + Table: phpbb_lang +*/ +CREATE TABLE phpbb_lang ( + lang_id number(4) NOT NULL, + lang_iso varchar2(5), + lang_dir varchar2(30), + lang_english_name varchar2(30), + lang_local_name varchar2(100), + lang_author varchar2(100), + CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id) +) +/ + +CREATE SEQUENCE sq_phpbb_lang_lang_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_lang_lang_id +BEFORE INSERT ON phpbb_lang +FOR EACH ROW WHEN ( + new.lang_id IS NULL OR new.lang_id = 0 +) +BEGIN + SELECT sq_phpbb_lang_lang_id.nextval + INTO :new.lang_id + FROM dual; +END; +/ + +/* + Table: phpbb_log +*/ +CREATE TABLE phpbb_log ( + log_id number(8) NOT NULL, + log_type number(4) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + reportee_id number(8) DEFAULT '0' NOT NULL, + log_ip varchar2(40), + log_time number(11) NOT NULL, + log_operation clob, + log_data clob, + CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id) +) +/ + +CREATE SEQUENCE sq_phpbb_log_log_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_log_log_id +BEFORE INSERT ON phpbb_log +FOR EACH ROW WHEN ( + new.log_id IS NULL OR new.log_id = 0 +) +BEGIN + SELECT sq_phpbb_log_log_id.nextval + INTO :new.log_id + FROM dual; +END; +/ + +CREATE INDEX log_type on phpbb_log (log_type) +/ +CREATE INDEX forum_id02 on phpbb_log (forum_id) +/ +CREATE INDEX topic_id02 on phpbb_log (topic_id) +/ +CREATE INDEX reportee_id on phpbb_log (reportee_id) +/ +CREATE INDEX user_id03 on phpbb_log (user_id) +/ + +/* + Table: phpbb_moderator_cache +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(30) DEFAULT '', + group_id number(8) DEFAULT '0' NOT NULL, + groupname varchar2(30) DEFAULT '', + display_on_index number(1) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX display_on_index on phpbb_moderator_cache (display_on_index) +/ +CREATE INDEX forum_id03 on phpbb_moderator_cache (forum_id) +/ + +/* + Table: phpbb_modules +*/ +CREATE TABLE phpbb_modules ( + module_id number(8) NOT NULL, + module_type varchar2(3) DEFAULT '', + module_title varchar2(50) DEFAULT '', + module_filename varchar2(50) DEFAULT '', + module_order number(4) DEFAULT '0' NOT NULL, + module_enabled number(1) DEFAULT '1' NOT NULL, + module_subs clob, + module_acl varchar2(255) DEFAULT '', + CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id) +) +/ + +CREATE SEQUENCE sq_phpbb_modules_module_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_modules_module_id +BEFORE INSERT ON phpbb_modules +FOR EACH ROW WHEN ( + new.module_id IS NULL OR new.module_id = 0 +) +BEGIN + SELECT sq_phpbb_modules_module_id.nextval + INTO :new.module_id + FROM dual; +END; +/ + +CREATE INDEX module_type on phpbb_modules (module_type, module_enabled) +/ + +/* + Table: phpbb_poll_results +*/ +CREATE TABLE phpbb_poll_results ( + poll_option_id number(4) DEFAULT '0' NOT NULL, + topic_id number(8) NOT NULL, + poll_option_text varchar2(255), + poll_option_total number(8) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX poll_option_id on phpbb_poll_results (poll_option_id) +/ +CREATE INDEX topic_id03 on phpbb_poll_results (topic_id) +/ + +/* + Table: phpbb_poll_voters +*/ +CREATE TABLE phpbb_poll_voters ( + topic_id number(8) DEFAULT '0' NOT NULL, + poll_option_id number(4) DEFAULT '0' NOT NULL, + vote_user_id number(8) DEFAULT '0' NOT NULL, + vote_user_ip varchar2(40) +) +/ + +CREATE INDEX topic_id04 on phpbb_poll_voters (topic_id) +/ +CREATE INDEX vote_user_id on phpbb_poll_voters (vote_user_id) +/ +CREATE INDEX vote_user_ip on phpbb_poll_voters (vote_user_ip) +/ + +/* + Table: phpbb_posts +*/ CREATE TABLE phpbb_posts ( - post_id number(4) NOT NULL, - topic_id number(4) DEFAULT '0' NOT NULL, - forum_id number(4) DEFAULT '0' NOT NULL, - poster_id number(4) DEFAULT '0' NOT NULL, - post_time number(11) DEFAULT '0' NOT NULL, - post_username varchar(30), - poster_ip char(8) DEFAULT '' NOT NULL, - enable_bbcode number(4) DEFAULT '1' NOT NULL, - enable_html number(4) DEFAULT '0' NOT NULL, - enable_smilies number(4) DEFAULT '1' NOT NULL, - enable_sig number(4) DEFAULT '1' NOT NULL, - post_edit_time number(11), - post_edit_count number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_posts_pkey PRIMARY KEY (post_id) -); -CREATE INDEX forum_id_phpbb_posts_index ON phpbb_posts (forum_id); -CREATE INDEX post_time_phpbb_posts_index ON phpbb_posts (post_time); -CREATE INDEX poster_id_phpbb_posts_index ON phpbb_posts (poster_id); -CREATE INDEX topic_id_phpbb_posts_index ON phpbb_posts (topic_id); - - -/* -------------------------------------------------------- - Table structure for table phpbb_posts_text --------------------------------------------------------- */ -CREATE TABLE phpbb_posts_text ( - post_id number(4) DEFAULT '0' NOT NULL, - bbcode_uid varchar(10) DEFAULT '', - post_subject varchar(255), - post_text varchar(2000), - CONSTRAINT phpbb_posts_text_pkey PRIMARY KEY (post_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_privmsgs --------------------------------------------------------- */ + post_id number(8) NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(5) DEFAULT '0' NOT NULL, + poster_id number(8) DEFAULT '0' NOT NULL, + icon_id number(4) DEFAULT '1' NOT NULL, + poster_ip varchar2(40), + post_time number(11) DEFAULT '0' NOT NULL, + post_approved number(1) DEFAULT '1' NOT NULL, + post_reported number(1) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' NOT NULL, + enable_html number(1) DEFAULT '0' NOT NULL, + enable_smilies number(1) DEFAULT '1' NOT NULL, + enable_magic_url number(1) DEFAULT '1' NOT NULL, + enable_sig number(1) DEFAULT '1' NOT NULL, + post_username varchar2(30), + post_subject varchar2(60), + post_text clob, + post_checksum varchar2(32), + post_encoding varchar2(11) DEFAULT 'iso-8859-15', + post_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + bbcode_uid varchar2(5) DEFAULT '', + post_edit_time number(11) DEFAULT '0' NOT NULL, + post_edit_reason varchar2(100), + post_edit_user number(8) DEFAULT '0' NOT NULL, + post_edit_count number(5) DEFAULT '0' NOT NULL, + post_edit_locked number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id) +) +/ + +CREATE SEQUENCE sq_phpbb_posts_post_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_posts_post_id +BEFORE INSERT ON phpbb_posts +FOR EACH ROW WHEN ( + new.post_id IS NULL OR new.post_id = 0 +) +BEGIN + SELECT sq_phpbb_posts_post_id.nextval + INTO :new.post_id + FROM dual; +END; +/ + +CREATE INDEX forum_id04 on phpbb_posts (forum_id) +/ +CREATE INDEX topic_id05 on phpbb_posts (topic_id) +/ +CREATE INDEX poster_ip on phpbb_posts (poster_ip) +/ +CREATE INDEX poster_id02 on phpbb_posts (poster_id) +/ +CREATE INDEX post_approved on phpbb_posts (post_approved) +/ +CREATE INDEX post_time on phpbb_posts (post_time) +/ + +/* + Table: phpbb_privmsgs +*/ CREATE TABLE phpbb_privmsgs ( - privmsgs_id number(4) NOT NULL, - privmsgs_type number(4) DEFAULT '0' NOT NULL, - privmsgs_subject varchar(255) DEFAULT '0' NOT NULL, - privmsgs_from_userid number(4) DEFAULT '0' NOT NULL, - privmsgs_to_userid number(4) DEFAULT '0' NOT NULL, - privmsgs_date number(4) DEFAULT '0' NOT NULL, - privmsgs_ip char(8) NOT NULL, - privmsgs_enable_bbcode number(1) DEFAULT '1' NOT NULL, - privmsgs_enable_html number(1) DEFAULT '0' NOT NULL, - privmsgs_enable_smilies number(1) DEFAULT '1' NOT NULL, - privmsgs_attach_sig number(1) DEFAULT '1' NOT NULL, - CONSTRAINT phpbb_privmsgs_pkey PRIMARY KEY (privmsgs_id) -); -CREATE INDEX privmsgs_from_userid_index ON phpbb_privmsgs (privmsgs_from_userid); -CREATE INDEX privmsgs_to_userid_index ON phpbb_privmsgs (privmsgs_to_userid); - - -/* -------------------------------------------------------- - Table structure for table phpbb_privmsgs_text --------------------------------------------------------- */ -CREATE TABLE phpbb_privmsgs_text ( - privmsgs_text_id number(4) DEFAULT '0' NOT NULL, - privmsgs_bbcode_uid char(10) DEFAULT '0' NOT NULL, - privmsgs_text varchar(2000), - CONSTRAINT phpbb_privmsgs_text_pkey PRIMARY KEY (privmsgs_text_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_ranks --------------------------------------------------------- */ -CREATE TABLE phpbb_ranks ( - rank_id number(4) NOT NULL, - rank_title varchar(50) DEFAULT '' NOT NULL, - rank_min number(4) DEFAULT '0' NOT NULL, - rank_special number(4) DEFAULT '0', - rank_image varchar(255), - CONSTRAINT phpbb_ranks_pkey PRIMARY KEY (rank_id) -); -CREATE INDEX rank_max_phpbb_ranks_index ON phpbb_ranks (rank_max); -CREATE INDEX rank_min_phpbb_ranks_index ON phpbb_ranks (rank_min); - - -/* -------------------------------------------------------- - Table structure for table phpbb_session --------------------------------------------------------- */ -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '0' NOT NULL, - session_user_id number(11) DEFAULT '0' NOT NULL, - session_start number(11) DEFAULT '0' NOT NULL, - session_time number(11) DEFAULT '0' NOT NULL, - session_last_visit number(11) DEFAULT '0' NOT NULL, - session_ip char(8) DEFAULT '0' NOT NULL, - session_page number(11) DEFAULT '0' NOT NULL, - session_logged_in number(11) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_sessions_pkey PRIMARY KEY (session_id) -); -CREATE INDEX session_id_ip_user_id ON phpbb_sessions (session_id, session_ip, session_user_id); - - -/* -------------------------------------------------------- - Table structure for table phpbb_smilies --------------------------------------------------------- */ -CREATE TABLE phpbb_smilies ( - smilies_id number(4) NOT NULL, - code varchar(50), - smile_url varchar(100), - emoticon varchar(75), - CONSTRAINT phpbb_smilies_pkey PRIMARY KEY (smilies_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_themes --------------------------------------------------------- */ -CREATE TABLE phpbb_themes ( - themes_id number(4) NOT NULL, - style_name varchar(30), - template_name varchar(30) DEFAULT '' NOT NULL, - head_stylesheet varchar(100), - body_background varchar(100), - body_bgcolor char(6), - body_text char(6), - body_link char(6), - body_vlink char(6), - body_alink char(6), - body_hlink char(6), - tr_color1 char(6), - tr_color2 char(6), - tr_color3 char(6), - tr_class1 varchar(25), - tr_class2 varchar(25), - tr_class3 varchar(25), - th_color1 char(6), - th_color2 char(6), - th_color3 char(6), - th_class1 varchar(25), - th_class2 varchar(25), - th_class3 varchar(25), - td_color1 char(6), - td_color2 char(6), - td_color3 char(6), - td_class1 varchar(25), - td_class2 varchar(25), - td_class3 varchar(25), - fontface1 varchar(25), - fontface2 varchar(25), - fontface3 varchar(25), - fontsize1 number(4), - fontsize2 number(4), - fontsize3 number(4), - fontcolor1 char(6), - fontcolor2 char(6), - fontcolor3 char(6), - span_class1 varchar(25), - span_class2 varchar(25), - span_class3 varchar(25), - CONSTRAINT phpbb_themes_pkey PRIMARY KEY (themes_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_themes_name --------------------------------------------------------- */ -CREATE TABLE phpbb_themes_name ( - themes_id number(4) DEFAULT '0' NOT NULL, - tr_color1_name varchar(50), - tr_color2_name varchar(50), - tr_color3_name varchar(50), - tr_class1_name varchar(50), - tr_class2_name varchar(50), - tr_class3_name varchar(50), - th_color1_name varchar(50), - th_color2_name varchar(50), - th_color3_name varchar(50), - th_class1_name varchar(50), - th_class2_name varchar(50), - th_class3_name varchar(50), - td_color1_name varchar(50), - td_color2_name varchar(50), - td_color3_name varchar(50), - td_class1_name varchar(50), - td_class2_name varchar(50), - td_class3_name varchar(50), - fontface1_name varchar(50), - fontface2_name varchar(50), - fontface3_name varchar(50), - fontsize1_name varchar(50), - fontsize2_name varchar(50), - fontsize3_name varchar(50), - fontcolor1_name varchar(50), - fontcolor2_name varchar(50), - fontcolor3_name varchar(50), - span_class1_name varchar(50), - span_class2_name varchar(50), - span_class3_name varchar(50), - CONSTRAINT phpbb_themes_name_pkey PRIMARY KEY (themes_id) -); - - -/* -------------------------------------------------------- - Table structure for table phpbb_topics --------------------------------------------------------- */ -CREATE TABLE phpbb_topics ( - topic_id number(4) NOT NULL, - topic_title varchar(100) DEFAULT '' NOT NULL, - topic_poster number(4) DEFAULT '0' NOT NULL, - topic_time number(11) DEFAULT '0' NOT NULL, - topic_views number(4) DEFAULT '0' NOT NULL, - topic_replies number(4) DEFAULT '0' NOT NULL, - forum_id number(4) DEFAULT '0' NOT NULL, - topic_status number(4) DEFAULT '0' NOT NULL, - topic_vote number(4) DEFAULT '0' NOT NULL, - topic_type number(4) DEFAULT '0' NOT NULL, - topic_moved_id number(4), - topic_last_post_id number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_topics_pkey PRIMARY KEY (topic_id) -); -CREATE INDEX phpbb_topics_index ON phpbb_topics (forum_id, topic_id); -CREATE INDEX forum_id_phpbb_topics_index ON phpbb_topics (forum_id); - -/* -------------------------------------------------------- - Table structure for table phpbb_topics_watch --------------------------------------------------------- */ -CREATE TABLE phpbb_topics_watch ( - topic_id number(4), - user_id number(4), - notify_status number(4) DEFAULT '0' NOT NULL -); -CREATE INDEX phpbb_topics_watch_index ON phpbb_topics_watch (topic_id, user_id); - -/* -------------------------------------------------------- - Table structure for table phpbb_user_group --------------------------------------------------------- */ -CREATE TABLE phpbb_user_group ( - group_id number(4) DEFAULT '0' NOT NULL, - user_id number(4) DEFAULT '0' NOT NULL, - user_pending number(4) -); -CREATE INDEX group_id_phpbb_user_group ON phpbb_user_group (group_id); -CREATE INDEX user_id_phpbb_user_group_index ON phpbb_user_group (user_id); + msg_id number(8) NOT NULL, + root_level number(8) DEFAULT '0' NOT NULL, + author_id number(8) DEFAULT '0' NOT NULL, + icon_id number(4) DEFAULT '1' NOT NULL, + author_ip varchar2(40) DEFAULT '', + message_time number(11) DEFAULT '0' NOT NULL, + message_reported number(1) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' NOT NULL, + enable_html number(1) DEFAULT '0' NOT NULL, + enable_smilies number(1) DEFAULT '1' NOT NULL, + enable_magic_url number(1) DEFAULT '1' NOT NULL, + enable_sig number(1) DEFAULT '1' NOT NULL, + message_subject varchar2(60), + message_text clob, + message_edit_reason varchar2(100), + message_edit_user number(8) DEFAULT '0' NOT NULL, + message_checksum varchar2(32) DEFAULT '', + message_encoding varchar2(11) DEFAULT 'iso-8859-15', + message_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + bbcode_uid varchar2(5) DEFAULT '', + message_edit_time number(11) DEFAULT '0' NOT NULL, + message_edit_count number(5) DEFAULT '0' NOT NULL, + to_address clob, + bcc_address clob, + CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) +) +/ +CREATE SEQUENCE sq_phpbb_privmsgs_msg_id +/ -/* -------------------------------------------------------- - Table structure for table phpbb_users --------------------------------------------------------- */ -CREATE TABLE phpbb_users ( - user_id number(4) NOT NULL, - user_active number(4), - username varchar(25) DEFAULT '' NOT NULL, - user_regdate number(11) DEFAULT '0' NOT NULL, - user_password varchar(32) DEFAULT '' NOT NULL, - user_autologin_key varchar(32), - user_email varchar(255), - user_icq varchar(15), - user_website varchar(100), - user_occ varchar(100), - user_from varchar(100), - user_interests varchar(255), - user_sig varchar(2000), - user_sig_bbcode_uid char(10), - user_style number(4), - user_aim varchar(255), - user_yim varchar(255), - user_msnm varchar(255), - user_posts number(4) DEFAULT '0' NOT NULL, - user_viewemail number(4), - user_attachsig number(4), - user_allowhtml number(4) DEFAULT '1', - user_allowbbcode number(4) DEFAULT '1', - user_allowsmile number(4) DEFAULT '1', - user_allow_pm number(4) DEFAULT '1' NOT NULL, - user_allowavatar number(4) DEFAULT '1' NOT NULL, - user_allow_viewonline number(4) DEFAULT '1' NOT NULL, - user_rank number(4) DEFAULT '0', - user_avatar varchar(100), - user_level number(4) DEFAULT '1', - user_lang varchar(255), - user_timezone number(4) DEFAULT '0' NOT NULL, - user_dateformat varchar(14) DEFAULT 'd M Y H:m' NOT NULL, - user_notify_pm number(4) DEFAULT '1' NOT NULL, - user_notify number(4), - user_actkey varchar(32), - user_newpasswd varchar(32), - CONSTRAINT phpbb_users_pkey PRIMARY KEY (user_id) -); - -/* -------------------------------------------------------- - Table structure for table phpbb_vote_desc --------------------------------------------------------- */ -CREATE TABLE phpbb_vote_desc ( - vote_id number(4) NOT NULL, - topic_id number(4) DEFAULT '0' NOT NULL, - vote_text varchar2(4000) NOT NULL, - vote_start number(4) DEFAULT '0' NOT NULL, - vote_length number(4) DEFAULT '0' NOT NULL, - CONSTRAINT phpbb_vote_dsc_pkey PRIMARY KEY (vote_id) -); -CREATE INDEX topic_id_phpbb_vote_desc_index ON phpbb_vote_desc (topic_id); - -/* -------------------------------------------------------- - Table structure for table phpbb_vote_results --------------------------------------------------------- */ -CREATE TABLE phpbb_vote_results ( - vote_id number(4) DEFAULT '0' NOT NULL, - vote_option_id number(4) DEFAULT '0' NOT NULL, - vote_option_text varchar(255) NOT NULL, - vote_result number(4) DEFAULT '0' NOT NULL -); -CREATE INDEX option_id_vote_results_index ON phpbb_vote_results (vote_option_id); - -/* -------------------------------------------------------- - Table structure for table phpbb_vote_voters --------------------------------------------------------- */ -CREATE TABLE phpbb_vote_voters ( - vote_id number(4) DEFAULT '0' NOT NULL, - vote_user_id number(4) DEFAULT '0' NOT NULL, - vote_user_ip char(8) NOT NULL -); -CREATE INDEX vote_id_vote_voters_index ON phpbb_vote_voters (vote_id); -CREATE INDEX vote_user_id_vote_voters_index ON phpbb_vote_voters (vote_user_id); -CREATE INDEX vote_user_ip_vote_voters_index ON phpbb_vote_voters (vote_user_ip); - -/* -------------------------------------------------------- - Table structure for table phpbb_words --------------------------------------------------------- */ -CREATE TABLE phpbb_words ( - word_id number(4) NOT NULL, - word varchar(100) DEFAULT '' NOT NULL, - replacement varchar(100) DEFAULT '' NOT NULL, - CONSTRAINT phpbb_words_pkey PRIMARY KEY (word_id) -); +CREATE OR REPLACE TRIGGER ai_phpbb_privmsgs_msg_id +BEFORE INSERT ON phpbb_privmsgs +FOR EACH ROW WHEN ( + new.msg_id IS NULL OR new.msg_id = 0 +) +BEGIN + SELECT sq_phpbb_privmsgs_msg_id.nextval + INTO :new.msg_id + FROM dual; +END; +/ + +CREATE INDEX author_ip on phpbb_privmsgs (author_ip) +/ +CREATE INDEX message_time on phpbb_privmsgs (message_time) +/ +CREATE INDEX author_id on phpbb_privmsgs (author_id) +/ +CREATE INDEX root_level on phpbb_privmsgs (root_level) +/ + +/* + Table: phpbb_privmsgs_folder +*/ +CREATE TABLE phpbb_privmsgs_folder ( + folder_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + folder_name varchar2(40) DEFAULT '', + pm_count number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id) +) +/ +CREATE SEQUENCE sq_phpbb_privmsgs_folder_folde +/ -/* -------------------------------------------------------- - Trigger structure for table phpbb_groups --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_PHPBB_GROUPS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "GROUP_ID" ON "PHPBB"."PHPBB_GROUPS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE OR REPLACE TRIGGER ai_phpbb_privmsgs_folder_folde +BEFORE INSERT ON phpbb_privmsgs_folder +FOR EACH ROW WHEN ( + new.folder_id IS NULL OR new.folder_id = 0 +) BEGIN -SELECT PHPBB_GROUPS_ID_SEQ.NEXTVAL -INTO :NEW.group_id -FROM DUAL; + SELECT sq_phpbb_privmsgs_folder_folde.nextval + INTO :new.folder_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_banlist --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_PHPBB_BANLIST_ID_SEQ" -BEFORE INSERT OR UPDATE OF "BAN_ID" ON "PHPBB"."PHPBB_BANLIST" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE INDEX user_id04 on phpbb_privmsgs_folder (user_id) +/ + +/* + Table: phpbb_privmsgs_rules +*/ +CREATE TABLE phpbb_privmsgs_rules ( + rule_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + rule_check number(4) DEFAULT '0' NOT NULL, + rule_connection number(4) DEFAULT '0' NOT NULL, + rule_string varchar2(255) DEFAULT '', + rule_user_id number(8) DEFAULT '0' NOT NULL, + rule_group_id number(8) DEFAULT '0' NOT NULL, + rule_action number(4) DEFAULT '0' NOT NULL, + rule_folder_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id) +) +/ + +CREATE SEQUENCE sq_phpbb_privmsgs_rules_rule_i +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_privmsgs_rules_rule_i +BEFORE INSERT ON phpbb_privmsgs_rules +FOR EACH ROW WHEN ( + new.rule_id IS NULL OR new.rule_id = 0 +) BEGIN -SELECT PHPBB_BANLIST_ID_SEQ.NEXTVAL -INTO :NEW.ban_id -FROM DUAL; + SELECT sq_phpbb_privmsgs_rules_rule_i.nextval + INTO :new.rule_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_categories --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_CATEGORIES_ID_SEQ" -BEFORE INSERT OR UPDATE OF "CAT_ID" ON "PHPBB"."PHPBB_CATEGORIES" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_privmsgs_to +*/ +CREATE TABLE phpbb_privmsgs_to ( + msg_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + author_id number(8) DEFAULT '0' NOT NULL, + deleted number(1) DEFAULT '0' NOT NULL, + new number(1) DEFAULT '1' NOT NULL, + unread number(1) DEFAULT '1' NOT NULL, + replied number(1) DEFAULT '0' NOT NULL, + marked number(1) DEFAULT '0' NOT NULL, + forwarded number(1) DEFAULT '0' NOT NULL, + folder_id number(10) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX msg_id on phpbb_privmsgs_to (msg_id) +/ +CREATE INDEX user_id05 on phpbb_privmsgs_to (user_id, folder_id) +/ + +/* + Table: phpbb_profile_fields +*/ +CREATE TABLE phpbb_profile_fields ( + field_id number(8) NOT NULL, + field_name varchar2(50) DEFAULT '', + field_desc varchar2(255) DEFAULT '', + field_type number(8) NOT NULL, + field_ident varchar2(20) DEFAULT '', + field_length varchar2(20) DEFAULT '', + field_minlen varchar2(255) DEFAULT '', + field_maxlen varchar2(255) DEFAULT '', + field_novalue varchar2(255) DEFAULT '', + field_default_value varchar2(255) DEFAULT '0', + field_validation varchar2(20) DEFAULT '', + field_required number(1) DEFAULT '0' NOT NULL, + field_show_on_reg number(1) DEFAULT '0' NOT NULL, + field_hide number(1) DEFAULT '0' NOT NULL, + field_no_view number(1) DEFAULT '0' NOT NULL, + field_active number(1) DEFAULT '0' NOT NULL, + field_order number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id) +) +/ + +CREATE SEQUENCE sq_phpbb_profile_fields_field_ +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_profile_fields_field_ +BEFORE INSERT ON phpbb_profile_fields +FOR EACH ROW WHEN ( + new.field_id IS NULL OR new.field_id = 0 +) BEGIN -SELECT PHPBB_CATEGORIES_ID_SEQ.NEXTVAL -INTO :NEW.cat_id -FROM DUAL; + SELECT sq_phpbb_profile_fields_field_.nextval + INTO :new.field_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_disallow --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_DISALLOW_ID_SEQ" -BEFORE INSERT OR UPDATE OF "DISALLOW_ID" ON "PHPBB"."PHPBB_DISALLOW" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE INDEX field_type on phpbb_profile_fields (field_type) +/ +CREATE INDEX field_order on phpbb_profile_fields (field_order) +/ + +/* + Table: phpbb_profile_fields_data +*/ +CREATE TABLE phpbb_profile_fields_data ( + user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id) +) +/ + +/* + Table: phpbb_profile_fields_lang +*/ +CREATE TABLE phpbb_profile_fields_lang ( + field_id number(8) DEFAULT '0' NOT NULL, + lang_id number(8) DEFAULT '0' NOT NULL, + option_id number(8) DEFAULT '0' NOT NULL, + field_type number(4) DEFAULT '0' NOT NULL, + value varchar2(255) DEFAULT '', + CONSTRAINT pk_phpbb_profile_fields_lang PRIMARY KEY (field_id, lang_id, option_id) +) +/ + +/* + Table: phpbb_profile_lang +*/ +CREATE TABLE phpbb_profile_lang ( + field_id number(8) DEFAULT '0' NOT NULL, + lang_id number(4) DEFAULT '0' NOT NULL, + lang_name varchar2(255) DEFAULT '', + lang_explain clob, + lang_default_value varchar2(255) DEFAULT '', + CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id) +) +/ + +/* + Table: phpbb_ranks +*/ +CREATE TABLE phpbb_ranks ( + rank_id number(5) NOT NULL, + rank_title varchar2(50), + rank_min number(8) DEFAULT '0' NOT NULL, + rank_special number(1) DEFAULT '0', + rank_image varchar2(100), + CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id) +) +/ + +CREATE SEQUENCE sq_phpbb_ranks_rank_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_ranks_rank_id +BEFORE INSERT ON phpbb_ranks +FOR EACH ROW WHEN ( + new.rank_id IS NULL OR new.rank_id = 0 +) BEGIN -SELECT PHPBB_DISALLOW_ID_SEQ.NEXTVAL -INTO :NEW.disallow_id -FROM DUAL; + SELECT sq_phpbb_ranks_rank_id.nextval + INTO :new.rank_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_forums --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_FORUMS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "FORUM_ID" ON "PHPBB"."PHPBB_FORUMS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_reports_reasons +*/ +CREATE TABLE phpbb_reports_reasons ( + reason_id number(6) NOT NULL, + reason_priority number(4) DEFAULT '0' NOT NULL, + reason_name varchar2(255) DEFAULT '', + reason_description clob, + CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id) +) +/ + +CREATE SEQUENCE sq_phpbb_reports_reasons_reaso +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_reports_reasons_reaso +BEFORE INSERT ON phpbb_reports_reasons +FOR EACH ROW WHEN ( + new.reason_id IS NULL OR new.reason_id = 0 +) BEGIN -SELECT PHPBB_FORUMS_ID_SEQ.NEXTVAL -INTO :NEW.forum_id -FROM DUAL; + SELECT sq_phpbb_reports_reasons_reaso.nextval + INTO :new.reason_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_forum_prune --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_FORUM_PRUNE_ID_SEQ" -BEFORE INSERT OR UPDATE OF "PRUNE_ID" ON "PHPBB"."PHPBB_FORUM_PRUNE" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_reports +*/ +CREATE TABLE phpbb_reports ( + report_id number(5) NOT NULL, + reason_id number(5) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + msg_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + user_notify number(1) DEFAULT '0' NOT NULL, + report_time number(10) DEFAULT '0' NOT NULL, + report_text clob, + CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) +) +/ + +CREATE SEQUENCE sq_phpbb_reports_report_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_reports_report_id +BEFORE INSERT ON phpbb_reports +FOR EACH ROW WHEN ( + new.report_id IS NULL OR new.report_id = 0 +) BEGIN -SELECT PHPBB_FORUM_PRUNE_ID_SEQ.NEXTVAL -INTO :NEW.prune_id -FROM DUAL; + SELECT sq_phpbb_reports_report_id.nextval + INTO :new.report_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_posts --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_POSTS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "POST_ID" ON "PHPBB"."PHPBB_POSTS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_search_results +*/ +CREATE TABLE phpbb_search_results ( + search_id number(11) DEFAULT '0' NOT NULL, + session_id varchar2(32) DEFAULT '', + search_time number(11) DEFAULT '0' NOT NULL, + search_array clob, + CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_id) +) +/ + +CREATE INDEX session_id on phpbb_search_results (session_id) +/ + +/* + Table: phpbb_search_wordlist +*/ +CREATE TABLE phpbb_search_wordlist ( + word_text varchar2(50) DEFAULT '', + word_id number(8) NOT NULL, + word_common number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_text) +) +/ + +CREATE SEQUENCE sq_phpbb_search_wordlist_word_ +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_search_wordlist_word_ +BEFORE INSERT ON phpbb_search_wordlist +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) BEGIN -SELECT PHPBB_POSTS_ID_SEQ.NEXTVAL -INTO :NEW.post_id -FROM DUAL; + SELECT sq_phpbb_search_wordlist_word_.nextval + INTO :new.word_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_privmsgs --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_PRIVMSGS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "PRIVMSGS_ID" ON "PHPBB"."PHPBB_PRIVMSGS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE INDEX word_id on phpbb_search_wordlist (word_id) +/ + +/* + Table: phpbb_search_wordmatch +*/ +CREATE TABLE phpbb_search_wordmatch ( + post_id number(8) DEFAULT '0' NOT NULL, + word_id number(8) DEFAULT '0' NOT NULL, + title_match number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX word_id02 on phpbb_search_wordmatch (word_id) +/ + +/* + Table: phpbb_sessions +*/ +CREATE TABLE phpbb_sessions ( + session_id varchar2(32) DEFAULT '', + session_user_id number(8) DEFAULT '0' NOT NULL, + session_last_visit number(11) DEFAULT '0' NOT NULL, + session_start number(11) DEFAULT '0' NOT NULL, + session_time number(11) DEFAULT '0' NOT NULL, + session_ip varchar2(40) DEFAULT '0', + session_browser varchar2(100) DEFAULT '', + session_page varchar2(100) DEFAULT '', + session_viewonline number(1) DEFAULT '1' NOT NULL, + session_admin number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id) +) +/ + +CREATE INDEX session_time on phpbb_sessions (session_time) +/ +CREATE INDEX session_user_id on phpbb_sessions (session_user_id) +/ + +/* + Table: phpbb_sitelist +*/ +CREATE TABLE phpbb_sitelist ( + site_id number(8) NOT NULL, + site_ip varchar2(40) DEFAULT '', + site_hostname varchar2(255) DEFAULT '', + ip_exclude number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sitelist PRIMARY KEY (site_id) +) +/ + +CREATE SEQUENCE sq_phpbb_sitelist_site_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_sitelist_site_id +BEFORE INSERT ON phpbb_sitelist +FOR EACH ROW WHEN ( + new.site_id IS NULL OR new.site_id = 0 +) BEGIN -SELECT PHPBB_PRIVMSGS_ID_SEQ.NEXTVAL -INTO :NEW.privmsgs_id -FROM DUAL; + SELECT sq_phpbb_sitelist_site_id.nextval + INTO :new.site_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_ranks --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_RANK_ID_SEQ" -BEFORE INSERT OR UPDATE OF "RANK_ID" ON "PHPBB"."PHPBB_RANKS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_smilies +*/ +CREATE TABLE phpbb_smilies ( + smiley_id number(4) NOT NULL, + code varchar2(10), + emotion varchar2(50), + smiley_url varchar2(50), + smiley_width number(4) NOT NULL, + smiley_height number(4) NOT NULL, + smiley_order number(4) NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id) +) +/ + +CREATE SEQUENCE sq_phpbb_smilies_smiley_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_smilies_smiley_id +BEFORE INSERT ON phpbb_smilies +FOR EACH ROW WHEN ( + new.smiley_id IS NULL OR new.smiley_id = 0 +) BEGIN -SELECT PHPBB_RANKS_ID_SEQ.NEXTVAL -INTO :NEW.rank_id -FROM DUAL; + SELECT sq_phpbb_smilies_smiley_id.nextval + INTO :new.smiley_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_smilies --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_SMILIES_ID_SEQ" -BEFORE INSERT OR UPDATE OF "SMILIES_ID" ON "PHPBB"."PHPBB_SMILIES" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_styles +*/ +CREATE TABLE phpbb_styles ( + style_id number(4) NOT NULL, + style_name varchar2(30) DEFAULT '', + style_copyright varchar2(50) DEFAULT '', + style_active number(1) DEFAULT '1' NOT NULL, + template_id number(4) NOT NULL, + theme_id number(4) NOT NULL, + imageset_id number(4) NOT NULL, + CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id), + CONSTRAINT u_style_name UNIQUE (style_name) +) +/ + +CREATE SEQUENCE sq_phpbb_styles_style_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_styles_style_id +BEFORE INSERT ON phpbb_styles +FOR EACH ROW WHEN ( + new.style_id IS NULL OR new.style_id = 0 +) BEGIN -SELECT PHPBB_SMILIES_ID_SEQ.NEXTVAL -INTO :NEW.smilies_id -FROM DUAL; + SELECT sq_phpbb_styles_style_id.nextval + INTO :new.style_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_themes --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_THEMES_ID_SEQ" -BEFORE INSERT OR UPDATE OF "THEMES_ID" ON "PHPBB"."PHPBB_THEMES" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE INDEX i_phpbb_styles on phpbb_styles (template_id) +/ +CREATE INDEX i_phpbb_styles02 on phpbb_styles (theme_id) +/ +CREATE INDEX i_phpbb_styles03 on phpbb_styles (imageset_id) +/ + +/* + Table: phpbb_styles_template +*/ +CREATE TABLE phpbb_styles_template ( + template_id number(4) NOT NULL, + template_name varchar2(30), + template_copyright varchar2(50), + template_path varchar2(30), + bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + template_storedb number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_styles_template PRIMARY KEY (template_id), + CONSTRAINT u_template_name UNIQUE (template_name) +) +/ + +CREATE SEQUENCE sq_phpbb_styles_template_templ +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_styles_template_templ +BEFORE INSERT ON phpbb_styles_template +FOR EACH ROW WHEN ( + new.template_id IS NULL OR new.template_id = 0 +) BEGIN -SELECT PHPBB_THEMES_ID_SEQ.NEXTVAL -INTO :NEW.themes_id -FROM DUAL; + SELECT sq_phpbb_styles_template_templ.nextval + INTO :new.template_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_topics --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_TOPICS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "TOPIC_ID" ON "PHPBB"."PHPBB_TOPICS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_styles_template_data +*/ +CREATE TABLE phpbb_styles_template_data ( + template_id number(4) NOT NULL, + template_filename varchar2(50) DEFAULT '', + template_included clob, + template_mtime number(11) DEFAULT '0' NOT NULL, + template_data clob +) +/ + +CREATE INDEX i_phpbb_styles_template_data on phpbb_styles_template_data (template_id) +/ +CREATE INDEX i_phpbb_styles_template_data02 on phpbb_styles_template_data (template_filename) +/ + +/* + Table: phpbb_styles_theme +*/ +CREATE TABLE phpbb_styles_theme ( + theme_id number(4) NOT NULL, + theme_name varchar2(30) DEFAULT '', + theme_copyright varchar2(50) DEFAULT '', + theme_path varchar2(30) DEFAULT '', + theme_storedb number(1) DEFAULT '0' NOT NULL, + theme_mtime number(11) DEFAULT '0' NOT NULL, + theme_data clob DEFAULT '', + CONSTRAINT pk_phpbb_styles_theme PRIMARY KEY (theme_id), + CONSTRAINT u_theme_name UNIQUE (theme_name) +) +/ + +CREATE SEQUENCE sq_phpbb_styles_theme_theme_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_styles_theme_theme_id +BEFORE INSERT ON phpbb_styles_theme +FOR EACH ROW WHEN ( + new.theme_id IS NULL OR new.theme_id = 0 +) BEGIN -SELECT PHPBB_TOPICS_ID_SEQ.NEXTVAL -INTO :NEW.topic_id -FROM DUAL; + SELECT sq_phpbb_styles_theme_theme_id.nextval + INTO :new.theme_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_users --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_USERS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "USER_ID" ON "PHPBB"."PHPBB_USERS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_styles_imageset +*/ +CREATE TABLE phpbb_styles_imageset ( + imageset_id number(4) NOT NULL, + imageset_name varchar2(30) DEFAULT '', + imageset_copyright varchar2(50) DEFAULT '', + imageset_path varchar2(30) DEFAULT '', + site_logo varchar2(200) DEFAULT '', + btn_post varchar2(200) DEFAULT '', + btn_post_pm varchar2(200) DEFAULT '', + btn_reply varchar2(200) DEFAULT '', + btn_reply_pm varchar2(200) DEFAULT '', + btn_locked varchar2(200) DEFAULT '', + btn_profile varchar2(200) DEFAULT '', + btn_pm varchar2(200) DEFAULT '', + btn_delete varchar2(200) DEFAULT '', + btn_info varchar2(200) DEFAULT '', + btn_quote varchar2(200) DEFAULT '', + btn_search varchar2(200) DEFAULT '', + btn_edit varchar2(200) DEFAULT '', + btn_report varchar2(200) DEFAULT '', + btn_email varchar2(200) DEFAULT '', + btn_www varchar2(200) DEFAULT '', + btn_icq varchar2(200) DEFAULT '', + btn_aim varchar2(200) DEFAULT '', + btn_yim varchar2(200) DEFAULT '', + btn_msnm varchar2(200) DEFAULT '', + btn_jabber varchar2(200) DEFAULT '', + btn_online varchar2(200) DEFAULT '', + btn_offline varchar2(200) DEFAULT '', + btn_friend varchar2(200) DEFAULT '', + btn_foe varchar2(200) DEFAULT '', + icon_unapproved varchar2(200) DEFAULT '', + icon_reported varchar2(200) DEFAULT '', + icon_attach varchar2(200) DEFAULT '', + icon_post varchar2(200) DEFAULT '', + icon_post_new varchar2(200) DEFAULT '', + icon_post_latest varchar2(200) DEFAULT '', + icon_post_newest varchar2(200) DEFAULT '', + forum varchar2(200) DEFAULT '', + forum_new varchar2(200) DEFAULT '', + forum_locked varchar2(200) DEFAULT '', + forum_link varchar2(200) DEFAULT '', + sub_forum varchar2(200) DEFAULT '', + sub_forum_new varchar2(200) DEFAULT '', + folder varchar2(200) DEFAULT '', + folder_moved varchar2(200) DEFAULT '', + folder_posted varchar2(200) DEFAULT '', + folder_new varchar2(200) DEFAULT '', + folder_new_posted varchar2(200) DEFAULT '', + folder_hot varchar2(200) DEFAULT '', + folder_hot_posted varchar2(200) DEFAULT '', + folder_hot_new varchar2(200) DEFAULT '', + folder_hot_new_posted varchar2(200) DEFAULT '', + folder_locked varchar2(200) DEFAULT '', + folder_locked_posted varchar2(200) DEFAULT '', + folder_locked_new varchar2(200) DEFAULT '', + folder_locked_new_posted varchar2(200) DEFAULT '', + folder_sticky varchar2(200) DEFAULT '', + folder_sticky_posted varchar2(200) DEFAULT '', + folder_sticky_new varchar2(200) DEFAULT '', + folder_sticky_new_posted varchar2(200) DEFAULT '', + folder_announce varchar2(200) DEFAULT '', + folder_announce_posted varchar2(200) DEFAULT '', + folder_announce_new varchar2(200) DEFAULT '', + folder_announce_new_posted varchar2(200) DEFAULT '', + folder_global varchar2(200) DEFAULT '', + folder_global_posted varchar2(200) DEFAULT '', + folder_global_new varchar2(200) DEFAULT '', + folder_global_new_posted varchar2(200) DEFAULT '', + poll_left varchar2(200) DEFAULT '', + poll_center varchar2(200) DEFAULT '', + poll_right varchar2(200) DEFAULT '', + attach_progress_bar varchar2(200) DEFAULT '', + user_icon1 varchar2(200) DEFAULT '', + user_icon2 varchar2(200) DEFAULT '', + user_icon3 varchar2(200) DEFAULT '', + user_icon4 varchar2(200) DEFAULT '', + user_icon5 varchar2(200) DEFAULT '', + user_icon6 varchar2(200) DEFAULT '', + user_icon7 varchar2(200) DEFAULT '', + user_icon8 varchar2(200) DEFAULT '', + user_icon9 varchar2(200) DEFAULT '', + user_icon10 varchar2(200) DEFAULT '', + CONSTRAINT pk_phpbb_styles_imageset PRIMARY KEY (imageset_id), + CONSTRAINT u_imageset_name UNIQUE (imageset_name) +) +/ + +CREATE SEQUENCE sq_phpbb_styles_imageset_image +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_styles_imageset_image +BEFORE INSERT ON phpbb_styles_imageset +FOR EACH ROW WHEN ( + new.imageset_id IS NULL OR new.imageset_id = 0 +) BEGIN -SELECT PHPBB_USERS_ID_SEQ.NEXTVAL -INTO :NEW.user_id -FROM DUAL; + SELECT sq_phpbb_styles_imageset_image.nextval + INTO :new.imageset_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_vote_desc --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_VOTE_DESC_ID_SEQ" -BEFORE INSERT OR UPDATE OF "VOTE_ID" ON "PHPBB"."PHPBB_VOTE_DESC" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +/* + Table: phpbb_topics +*/ +CREATE TABLE phpbb_topics ( + topic_id number(8) NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + icon_id number(4) DEFAULT '1' NOT NULL, + topic_attachment number(1) DEFAULT '0' NOT NULL, + topic_approved number(1) DEFAULT '1' NOT NULL, + topic_reported number(1) DEFAULT '0' NOT NULL, + topic_title varchar2(60), + topic_poster number(8) DEFAULT '0' NOT NULL, + topic_time number(11) DEFAULT '0' NOT NULL, + topic_time_limit number(11) DEFAULT '0' NOT NULL, + topic_views number(8) DEFAULT '0' NOT NULL, + topic_replies number(8) DEFAULT '0' NOT NULL, + topic_replies_real number(8) DEFAULT '0' NOT NULL, + topic_status number(3) DEFAULT '0' NOT NULL, + topic_type number(3) DEFAULT '0' NOT NULL, + topic_first_post_id number(8) DEFAULT '0' NOT NULL, + topic_first_poster_name varchar2(30), + topic_last_post_id number(8) DEFAULT '0' NOT NULL, + topic_last_poster_id number(8) DEFAULT '0' NOT NULL, + topic_last_poster_name varchar2(30), + topic_last_post_time number(11) DEFAULT '0' NOT NULL, + topic_last_view_time number(11) DEFAULT '0' NOT NULL, + topic_moved_id number(8) DEFAULT '0' NOT NULL, + topic_bumped number(1) DEFAULT '0' NOT NULL, + topic_bumper number(8) DEFAULT '0' NOT NULL, + poll_title varchar2(255), + poll_start number(11) DEFAULT '0' NOT NULL, + poll_length number(11) DEFAULT '0' NOT NULL, + poll_max_options number(4) DEFAULT '1' NOT NULL, + poll_last_vote number(11) DEFAULT '0', + poll_vote_change number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id) +) +/ + +CREATE SEQUENCE sq_phpbb_topics_topic_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_topics_topic_id +BEFORE INSERT ON phpbb_topics +FOR EACH ROW WHEN ( + new.topic_id IS NULL OR new.topic_id = 0 +) +BEGIN + SELECT sq_phpbb_topics_topic_id.nextval + INTO :new.topic_id + FROM dual; +END; +/ + +CREATE INDEX forum_id05 on phpbb_topics (forum_id) +/ +CREATE INDEX forum_id_type on phpbb_topics (forum_id, topic_type) +/ +CREATE INDEX topic_last_post_time on phpbb_topics (topic_last_post_time) +/ + +/* + Table: phpbb_topics_marking +*/ +CREATE TABLE phpbb_topics_marking ( + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + mark_type number(4) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics_marking PRIMARY KEY (user_id, topic_id) +) +/ + +/* + Table: phpbb_topics_watch +*/ +CREATE TABLE phpbb_topics_watch ( + topic_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + notify_status number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX topic_id06 on phpbb_topics_watch (topic_id) +/ +CREATE INDEX user_id06 on phpbb_topics_watch (user_id) +/ +CREATE INDEX notify_status02 on phpbb_topics_watch (notify_status) +/ + +/* + Table: phpbb_user_group +*/ +CREATE TABLE phpbb_user_group ( + group_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + group_leader number(1) DEFAULT '0' NOT NULL, + user_pending number(1) +) +/ + +CREATE INDEX group_id02 on phpbb_user_group (group_id) +/ +CREATE INDEX user_id07 on phpbb_user_group (user_id) +/ +CREATE INDEX group_leader on phpbb_user_group (group_leader) +/ + +/* + Table: phpbb_users +*/ +CREATE TABLE phpbb_users ( + user_id number(8) NOT NULL, + user_type number(1) DEFAULT '0' NOT NULL, + group_id number(8) DEFAULT '3' NOT NULL, + user_permissions clob DEFAULT '', + user_ip varchar2(40) DEFAULT '', + user_regdate number(11) DEFAULT '0' NOT NULL, + username varchar2(30) DEFAULT '', + user_password varchar2(32) DEFAULT '', + user_passchg number(11) DEFAULT '0' NOT NULL, + user_email varchar2(60) DEFAULT '', + user_email_hash number(20) DEFAULT '0' NOT NULL, + user_birthday varchar2(10) DEFAULT '', + user_lastvisit number(11) DEFAULT '0' NOT NULL, + user_lastpost_time number(11) DEFAULT '0' NOT NULL, + user_lastpage varchar2(100) DEFAULT '', + user_last_confirm_key varchar2(10) DEFAULT '', + user_warnings number(4) DEFAULT '0' NOT NULL, + user_posts number(8) DEFAULT '0' NOT NULL, + user_lang varchar2(30) DEFAULT '', + user_timezone number(5, 2) DEFAULT '1' NOT NULL, + user_dst number(1) DEFAULT '0' NOT NULL, + user_dateformat varchar2(15) DEFAULT 'd M Y H:i', + user_style number(4) DEFAULT '0' NOT NULL, + user_rank number(11) DEFAULT '0', + user_colour varchar2(6) DEFAULT '', + user_new_privmsg number(4) DEFAULT '0' NOT NULL, + user_unread_privmsg number(4) DEFAULT '0' NOT NULL, + user_last_privmsg number(11) DEFAULT '0' NOT NULL, + user_message_rules number(1) DEFAULT '0' NOT NULL, + user_full_folder number(11) DEFAULT '1' NOT NULL, + user_emailtime number(11) DEFAULT '0' NOT NULL, + user_topic_show_days number(4) DEFAULT '0' NOT NULL, + user_topic_sortby_type varchar2(1) DEFAULT '', + user_topic_sortby_dir varchar2(1) DEFAULT '', + user_post_show_days number(4) DEFAULT '0' NOT NULL, + user_post_sortby_type varchar2(1) DEFAULT '', + user_post_sortby_dir varchar2(1) DEFAULT '', + user_notify number(1) DEFAULT '0' NOT NULL, + user_notify_pm number(1) DEFAULT '1' NOT NULL, + user_notify_type number(4) DEFAULT '0' NOT NULL, + user_allow_pm number(1) DEFAULT '1' NOT NULL, + user_allow_email number(1) DEFAULT '1' NOT NULL, + user_allow_viewonline number(1) DEFAULT '1' NOT NULL, + user_allow_viewemail number(1) DEFAULT '1' NOT NULL, + user_allow_massemail number(1) DEFAULT '1' NOT NULL, + user_options number(11) DEFAULT '893' NOT NULL, + user_avatar varchar2(100) DEFAULT '', + user_avatar_type number(2) DEFAULT '0' NOT NULL, + user_avatar_width number(4) DEFAULT '0' NOT NULL, + user_avatar_height number(4) DEFAULT '0' NOT NULL, + user_sig clob DEFAULT '', + user_sig_bbcode_uid varchar2(5) DEFAULT '', + user_sig_bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + user_from varchar2(100) DEFAULT '', + user_icq varchar2(15) DEFAULT '', + user_aim varchar2(255) DEFAULT '', + user_yim varchar2(255) DEFAULT '', + user_msnm varchar2(255) DEFAULT '', + user_jabber varchar2(255) DEFAULT '', + user_website varchar2(100) DEFAULT '', + user_occ varchar2(255) DEFAULT '', + user_interests varchar2(255) DEFAULT '', + user_actkey varchar2(32) DEFAULT '', + user_newpasswd varchar2(32) DEFAULT '', + CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id) +) +/ + +CREATE SEQUENCE sq_phpbb_users_user_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_users_user_id +BEFORE INSERT ON phpbb_users +FOR EACH ROW WHEN ( + new.user_id IS NULL OR new.user_id = 0 +) BEGIN -SELECT PHPBB_VOTE_DESC_ID_SEQ.NEXTVAL -INTO :NEW.vote_id -FROM DUAL; + SELECT sq_phpbb_users_user_id.nextval + INTO :new.user_id + FROM dual; END; / -/* -------------------------------------------------------- - Trigger structure for table phpbb_words --------------------------------------------------------- */ -CREATE OR REPLACE TRIGGER "PHPBB"."SET_WORDS_ID_SEQ" -BEFORE INSERT OR UPDATE OF "WORD_ID" ON "PHPBB"."PHPBB_WORDS" -REFERENCING OLD AS OLD NEW AS NEW -FOR EACH ROW +CREATE INDEX user_birthday on phpbb_users (user_birthday) +/ +CREATE INDEX user_email_hash on phpbb_users (user_email_hash) +/ +CREATE INDEX username on phpbb_users (username) +/ + +/* + Table: phpbb_words +*/ +CREATE TABLE phpbb_words ( + word_id number(8) NOT NULL, + word varchar2(100), + replacement varchar2(100), + CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id) +) +/ + +CREATE SEQUENCE sq_phpbb_words_word_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_words_word_id +BEFORE INSERT ON phpbb_words +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) BEGIN -SELECT PHPBB_WORDS_ID_SEQ.NEXTVAL -INTO :NEW.word_id -FROM DUAL; + SELECT sq_phpbb_words_word_id.nextval + INTO :new.word_id + FROM dual; END; / -COMMIT;
\ No newline at end of file +/* + Table: phpbb_zebra +*/ +CREATE TABLE phpbb_zebra ( + user_id number(8) DEFAULT '0' NOT NULL, + zebra_id number(8) DEFAULT '0' NOT NULL, + friend number(1) DEFAULT '0' NOT NULL, + foe number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX user_id08 on phpbb_zebra (user_id) +/ +CREATE INDEX zebra_id on phpbb_zebra (zebra_id) +/ + diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index b07992cdfe..9ce7f4864c 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1,6 +1,5 @@ /* - phpBB2 PostgreSQL DB schema - phpBB group 2001 - + PostgreSQL Schema for phpBB 3.x - (c) phpBB Group, 2005 $Id$ */ diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 18c0576547..a1c74ecfb4 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -1,5 +1,5 @@ # -# Basic DB data for phpBB2 devel +# Basic DB Data for phpBB 3.x - (c) phpBB Group, 2005 # # $Id$ # diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index c0385261c2..090d8427dd 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -1,716 +1,930 @@ --- --- phpbb - Firebird schema --- --- $Id$ --- +# +# SQLite Schema for phpBB 3.x - (c) phpBB Group, 2005 +# +# $Id$ +# --- Table: phpbb_attachments +BEGIN TRANSACTION; + +# Table: phpbb_attachments CREATE TABLE phpbb_attachments ( - attach_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - privmsgs_id INTEGER DEFAULT 0 NOT NULL, - user_id_from INTEGER NOT NULL, - user_id_to INTEGER NOT NULL -); - -CREATE INDEX attach_id ON phpbb_attachments (attach_id); - --- Table: phpbb_attach_desc -CREATE TABLE phpbb_attach_desc ( - attach_id INTEGER NOT NULL, - physical_filename VARCHAR(255) NOT NULL, - real_filename VARCHAR(255) NOT NULL, - download_count INTEGER DEFAULT 0 NOT NULL, - comment VARCHAR(255) DEFAULT '', - extension VARCHAR(100), - mimetype VARCHAR(100), - filesize INTEGER NOT NULL, - filetime INTEGER DEFAULT 0 NOT NULL, - thumbnail INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (attach_id) -); - -CREATE INDEX filetime ON phpbb_attach_desc (filetime); -CREATE INDEX physical_filename ON phpbb_attach_desc (physical_filename); -CREATE INDEX filesize ON phpbb_attach_desc (filesize); - --- Table: phpbb_auth_groups + attach_id INTEGER PRIMARY KEY NOT NULL, + post_msg_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + in_message tinyint(1) NOT NULL DEFAULT '0', + poster_id mediumint(8) NOT NULL DEFAULT '0', + physical_filename varchar(255) NOT NULL, + real_filename varchar(255) NOT NULL, + download_count mediumint(8) NOT NULL DEFAULT '0', + comment varchar(255), + extension varchar(100), + mimetype varchar(100), + filesize int(20) NOT NULL, + filetime int(11) NOT NULL DEFAULT '0', + thumbnail tinyint(1) NOT NULL DEFAULT '0' +); + +CREATE INDEX filetime_phpbb_attachments on phpbb_attachments (filetime); +CREATE INDEX post_msg_id_phpbb_attachments on phpbb_attachments (post_msg_id); +CREATE INDEX topic_id_phpbb_attachments on phpbb_attachments (topic_id); +CREATE INDEX poster_id_phpbb_attachments on phpbb_attachments (poster_id); +CREATE INDEX physical_filename_phpbb_attach on phpbb_attachments (physical_filename); +CREATE INDEX filesize_phpbb_attachments on phpbb_attachments (filesize); + +# Table: phpbb_auth_groups CREATE TABLE phpbb_auth_groups ( - group_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL + group_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + auth_option_id smallint(5) NOT NULL DEFAULT '0', + auth_setting tinyint(4) NOT NULL DEFAULT '0' ); -CREATE INDEX group_id ON phpbb_auth_groups (group_id); -CREATE INDEX auth_option_id ON phpbb_auth_groups (auth_option_id); +CREATE INDEX group_id_phpbb_auth_groups on phpbb_auth_groups (group_id); +CREATE INDEX auth_option_id_phpbb_auth_grou on phpbb_auth_groups (auth_option_id); --- Table: phpbb_auth_options +# Table: phpbb_auth_options CREATE TABLE phpbb_auth_options ( - auth_option_id INTEGER NOT NULL, - auth_option CHAR(20) NOT NULL, - is_global INTEGER DEFAULT 0 NOT NULL, - is_local INTEGER DEFAULT 0 NOT NULL, - founder_only INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (auth_option_id) + auth_option_id INTEGER PRIMARY KEY NOT NULL, + auth_option char(20) NOT NULL, + is_global tinyint(1) NOT NULL DEFAULT '0', + is_local tinyint(1) NOT NULL DEFAULT '0', + founder_only tinyint(1) NOT NULL DEFAULT '0' ); -CREATE INDEX auth_option ON phpbb_auth_options (auth_option); +CREATE INDEX auth_option_phpbb_auth_options on phpbb_auth_options (auth_option); --- Table: phpbb_auth_presets +# Table: phpbb_auth_presets CREATE TABLE phpbb_auth_presets ( - preset_id INTEGER NOT NULL, - preset_name VARCHAR(50) NOT NULL, - preset_user_id INTEGER NOT NULL, - preset_type VARCHAR(2) NOT NULL, - preset_data TEXT, - PRIMARY KEY (preset_id) + preset_id INTEGER PRIMARY KEY NOT NULL, + preset_name varchar(50) NOT NULL DEFAULT '', + preset_user_id mediumint(5) NOT NULL DEFAULT '0', + preset_type varchar(2) NOT NULL DEFAULT '', + preset_data text(65535) NOT NULL DEFAULT '' ); -CREATE INDEX preset_type ON phpbb_auth_presets (preset_type); +CREATE INDEX preset_type_phpbb_auth_presets on phpbb_auth_presets (preset_type); --- Table: phpbb_auth_users +# Table: phpbb_auth_users CREATE TABLE phpbb_auth_users ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + auth_option_id smallint(5) NOT NULL DEFAULT '0', + auth_setting tinyint(4) NOT NULL DEFAULT '0' ); -CREATE INDEX user_id ON phpbb_auth_users (user_id); -CREATE INDEX auth_option_id2 ON phpbb_auth_users (auth_option_id); +CREATE INDEX user_id_phpbb_auth_users on phpbb_auth_users (user_id); +CREATE INDEX auth_option_id_phpbb_auth_user on phpbb_auth_users (auth_option_id); --- Table: 'phpbb_banlist' +# Table: phpbb_banlist CREATE TABLE phpbb_banlist ( - ban_id INTEGER NOT NULL, - ban_userid INTEGER DEFAULT 0 NOT NULL, - ban_ip VARCHAR(40) DEFAULT '' NOT NULL, - ban_email VARCHAR(50) DEFAULT '' NOT NULL, - ban_start INTEGER DEFAULT 0 NOT NULL, - ban_end INTEGER DEFAULT 0 NOT NULL, - ban_exclude INTEGER DEFAULT 0 NOT NULL, - ban_reason VARCHAR(255), - ban_give_reason VARCHAR(255) DEFAULT '' NOT NULL, - PRIMARY KEY (ban_id) -); - --- Table: 'phpbb_cache' + ban_id INTEGER PRIMARY KEY NOT NULL, + ban_userid mediumint(8) NOT NULL DEFAULT '0', + ban_ip varchar(40) NOT NULL DEFAULT '', + ban_email varchar(50) NOT NULL DEFAULT '', + ban_start int(11) NOT NULL DEFAULT '0', + ban_end int(11) NOT NULL DEFAULT '0', + ban_exclude tinyint(1) NOT NULL DEFAULT '0', + ban_reason varchar(255) NOT NULL DEFAULT '', + ban_give_reason varchar(255) NOT NULL DEFAULT '' +); + +# Table: phpbb_bbcodes +CREATE TABLE phpbb_bbcodes ( + bbcode_id INTEGER PRIMARY KEY NOT NULL DEFAULT '0', + bbcode_tag varchar(16) NOT NULL DEFAULT '', + bbcode_match varchar(255) NOT NULL DEFAULT '', + bbcode_tpl text(65535) NOT NULL DEFAULT '', + first_pass_match varchar(255) NOT NULL DEFAULT '', + first_pass_replace varchar(255) NOT NULL DEFAULT '', + second_pass_match varchar(255) NOT NULL DEFAULT '', + second_pass_replace text(65535) NOT NULL DEFAULT '' +); + +# Table: phpbb_bookmarks +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + order_id mediumint(8) NOT NULL DEFAULT '0' +); + +CREATE INDEX order_id_phpbb_bookmarks on phpbb_bookmarks (order_id); +CREATE INDEX topic_user_id_phpbb_bookmarks on phpbb_bookmarks (topic_id, user_id); + +# Table: phpbb_bots +CREATE TABLE phpbb_bots ( + bot_id INTEGER PRIMARY KEY NOT NULL, + bot_active tinyint(1) NOT NULL DEFAULT '1', + bot_name varchar(255) NOT NULL DEFAULT '', + user_id mediumint(8) NOT NULL DEFAULT '0', + bot_agent varchar(255) NOT NULL DEFAULT '', + bot_ip varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX bot_active_phpbb_bots on phpbb_bots (bot_active); + +# Table: phpbb_cache CREATE TABLE phpbb_cache ( - var_name VARCHAR(255) NOT NULL, - var_ts INTEGER DEFAULT 0 NOT NULL, - var_data TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (var_name) + var_name varchar(255) NOT NULL DEFAULT '', + var_expires int(10) NOT NULL DEFAULT '0', + var_data mediumtext(16777215) NOT NULL, + PRIMARY KEY (var_name) ); --- Table: 'phpbb_config' +# Table: phpbb_config CREATE TABLE phpbb_config ( - config_name VARCHAR(50) NOT NULL, - config_value VARCHAR(255) NOT NULL, - is_dynamic INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (config_name) + config_name varchar(255) NOT NULL, + config_value varchar(255) NOT NULL, + is_dynamic tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (config_name) ); -CREATE INDEX is_dynamic ON phpbb_config (is_dynamic); +CREATE INDEX is_dynamic_phpbb_config on phpbb_config (is_dynamic); --- Table: 'phpbb_confirm' +# Table: phpbb_confirm CREATE TABLE phpbb_confirm ( - confirm_id CHAR(32) DEFAULT '' NOT NULL, - session_id CHAR(32) DEFAULT '' NOT NULL, - code CHAR(6) DEFAULT '' NOT NULL, - PRIMARY KEY (session_id, confirm_id) + confirm_id char(32) NOT NULL DEFAULT '', + session_id char(32) NOT NULL DEFAULT '', + code char(6) NOT NULL DEFAULT '', + PRIMARY KEY (session_id, confirm_id) ); --- Table: 'phpbb_disallow' +# Table: phpbb_disallow CREATE TABLE phpbb_disallow ( - disallow_id INTEGER NOT NULL, - disallow_username VARCHAR(30), - PRIMARY KEY (disallow_id) + disallow_id INTEGER PRIMARY KEY NOT NULL, + disallow_username varchar(30) NOT NULL DEFAULT '' ); --- Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id INTEGER NOT NULL, - group_id INTEGER DEFAULT 0 NOT NULL, - extension VARCHAR(100) DEFAULT '' NOT NULL, - comment VARCHAR(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) +# Table: phpbb_drafts +CREATE TABLE phpbb_drafts ( + draft_id INTEGER PRIMARY KEY NOT NULL, + user_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + save_time int(11) NOT NULL DEFAULT '0', + draft_subject varchar(60), + draft_message mediumtext(16777215) NOT NULL DEFAULT '' ); --- Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id INTEGER NOT NULL, - group_name VARCHAR(20) DEFAULT '' NOT NULL, - cat_id INTEGER DEFAULT 0 NOT NULL, - allow_group INTEGER DEFAULT 0 NOT NULL, - download_mode INTEGER DEFAULT 1 NOT NULL, - upload_icon VARCHAR(100) DEFAULT '' NOT NULL, - max_filesize INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (group_id) +CREATE INDEX save_time_phpbb_drafts on phpbb_drafts (save_time); + +# Table: phpbb_extensions +CREATE TABLE phpbb_extensions ( + extension_id INTEGER PRIMARY KEY NOT NULL, + group_id mediumint(8) NOT NULL DEFAULT '0', + extension varchar(100) NOT NULL DEFAULT '' ); --- Table: 'phpbb_forums' +# Table: phpbb_extension_groups +CREATE TABLE phpbb_extension_groups ( + group_id INTEGER PRIMARY KEY NOT NULL, + group_name char(20) NOT NULL, + cat_id tinyint(2) NOT NULL DEFAULT '0', + allow_group tinyint(1) NOT NULL DEFAULT '0', + download_mode tinyint(1) NOT NULL DEFAULT '1', + upload_icon varchar(100) NOT NULL DEFAULT '', + max_filesize int(20) NOT NULL DEFAULT '0', + allowed_forums text(65535) NOT NULL, + allow_in_pm tinyint(1) NOT NULL DEFAULT '0' +); + +# Table: phpbb_forums CREATE TABLE phpbb_forums ( - forum_id INTEGER NOT NULL, - parent_id INTEGER NOT NULL, - left_id INTEGER NOT NULL, - right_id INTEGER NOT NULL, - forum_parents TEXT, - forum_name VARCHAR(150) NOT NULL, - forum_desc TEXT, - forum_link VARCHAR(200) DEFAULT '' NOT NULL, - forum_password VARCHAR(32) DEFAULT '' NOT NULL, - forum_style INTEGER DEFAULT 0 NOT NULL, - forum_image VARCHAR(50) DEFAULT '' NOT NULL, - forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, - forum_type INTEGER DEFAULT 0 NOT NULL, - forum_status INTEGER DEFAULT 0 NOT NULL, - forum_posts INTEGER DEFAULT 0 NOT NULL, - forum_topics INTEGER DEFAULT 0 NOT NULL, - forum_topics_real INTEGER DEFAULT 0 NOT NULL, - forum_last_post_id INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, - forum_last_post_time INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_name VARCHAR(30) DEFAULT '' NOT NULL, - forum_flags INTEGER DEFAULT 0 NOT NULL, - display_on_index INTEGER DEFAULT 1 NOT NULL, - enable_icons INTEGER DEFAULT 1 NOT NULL, - enable_prune INTEGER DEFAULT 0 NOT NULL, - prune_next INTEGER DEFAULT 0 NOT NULL, - prune_days INTEGER DEFAULT 0 NOT NULL, - prune_freq INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (forum_id) -); - -CREATE INDEX left_id ON phpbb_forums (left_id); -CREATE INDEX forum_last_post_id ON phpbb_forums (forum_last_post_id); - --- Table: phpbb_forum_access + forum_id INTEGER PRIMARY KEY NOT NULL, + parent_id smallint(5) NOT NULL, + left_id smallint(5) NOT NULL, + right_id smallint(5) NOT NULL, + forum_parents text(65535), + forum_name varchar(150) NOT NULL, + forum_desc text(65535), + forum_link varchar(200) NOT NULL DEFAULT '', + forum_password varchar(32) NOT NULL DEFAULT '', + forum_style tinyint(4), + forum_image varchar(50) NOT NULL DEFAULT '', + forum_rules text(65535) NOT NULL DEFAULT '', + forum_rules_link varchar(200) NOT NULL DEFAULT '', + forum_rules_flags tinyint(4) NOT NULL DEFAULT '0', + forum_rules_bbcode_bitfield int(11) NOT NULL DEFAULT '0', + forum_rules_bbcode_uid varchar(5) NOT NULL DEFAULT '', + forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', + forum_type tinyint(4) NOT NULL DEFAULT '0', + forum_status tinyint(4) NOT NULL DEFAULT '0', + forum_posts mediumint(8) NOT NULL DEFAULT '0', + forum_topics mediumint(8) NOT NULL DEFAULT '0', + forum_topics_real mediumint(8) NOT NULL DEFAULT '0', + forum_last_post_id mediumint(8) NOT NULL DEFAULT '0', + forum_last_poster_id mediumint(8) NOT NULL DEFAULT '0', + forum_last_post_time int(11) NOT NULL DEFAULT '0', + forum_last_poster_name varchar(30), + forum_flags tinyint(4) NOT NULL DEFAULT '0', + display_on_index tinyint(1) NOT NULL DEFAULT '1', + enable_indexing tinyint(1) NOT NULL DEFAULT '1', + enable_icons tinyint(1) NOT NULL DEFAULT '1', + enable_prune tinyint(1) NOT NULL DEFAULT '0', + prune_next int(11), + prune_days tinyint(4) NOT NULL, + prune_viewed tinyint(4) NOT NULL, + prune_freq tinyint(4) NOT NULL DEFAULT '0' +); + +CREATE INDEX left_right_id_phpbb_forums on phpbb_forums (left_id, right_id); +CREATE INDEX forum_last_post_id_phpbb_forum on phpbb_forums (forum_last_post_id); + +# Table: phpbb_forum_access CREATE TABLE phpbb_forum_access ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - session_id CHAR(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id,user_id,session_id) + forum_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + PRIMARY KEY (forum_id, user_id, session_id) ); --- Table: 'phpbb_forums_marking' +# Table: phpbb_forums_marking CREATE TABLE phpbb_forums_marking ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (user_id, forum_id) + user_id mediumint(9) NOT NULL DEFAULT '0', + forum_id mediumint(9) NOT NULL DEFAULT '0', + mark_time int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, forum_id) ); --- Table: 'phpbb_forums_watch' +# Table: phpbb_forums_watch CREATE TABLE phpbb_forums_watch ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL + forum_id smallint(5) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL DEFAULT '0' ); -CREATE INDEX forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX user_id2 ON phpbb_forums_watch (user_id); -CREATE INDEX notify_status ON phpbb_forums_watch (notify_status); +CREATE INDEX forum_id_phpbb_forums_watch on phpbb_forums_watch (forum_id); +CREATE INDEX user_id_phpbb_forums_watch on phpbb_forums_watch (user_id); +CREATE INDEX notify_status_phpbb_forums_wat on phpbb_forums_watch (notify_status); --- Table: 'phpbb_groups' +# Table: phpbb_groups CREATE TABLE phpbb_groups ( - group_id INTEGER NOT NULL, - group_type INTEGER DEFAULT 1 NOT NULL, - group_name VARCHAR(40) DEFAULT '' NOT NULL, - group_display INTEGER DEFAULT 0 NOT NULL, - group_avatar VARCHAR(100) DEFAULT '' NOT NULL, - group_avatar_type INTEGER DEFAULT 0 NOT NULL, - group_rank INTEGER DEFAULT 0 NOT NULL, - group_colour VARCHAR(6) DEFAULT '' NOT NULL, - group_description VARCHAR(255) DEFAULT '' NOT NULL, - PRIMARY KEY (group_id) -); - --- Table: 'phpbb_groups_moderator' -CREATE TABLE phpbb_groups_moderator ( - group_id INTEGER NOT NULL, - user_id INTEGER NOT NULL -); - --- Table: 'phpbb_icons' + group_id INTEGER PRIMARY KEY NOT NULL, + group_type tinyint(4) NOT NULL DEFAULT '1', + group_name varchar(40) NOT NULL DEFAULT '', + group_display tinyint(1) NOT NULL DEFAULT '0', + group_avatar varchar(100) NOT NULL DEFAULT '', + group_avatar_type tinyint(4) NOT NULL DEFAULT '0', + group_avatar_width tinyint(4) NOT NULL DEFAULT '0', + group_avatar_height tinyint(4) NOT NULL DEFAULT '0', + group_rank smallint(5) NOT NULL DEFAULT '-1', + group_colour varchar(6) NOT NULL DEFAULT '', + group_sig_chars mediumint(8) NOT NULL DEFAULT '0', + group_receive_pm tinyint(1) NOT NULL DEFAULT '0', + group_message_limit mediumint(8) NOT NULL DEFAULT '0', + group_chgpass smallint(6) NOT NULL DEFAULT '0', + group_description varchar(255) NOT NULL DEFAULT '', + group_legend tinyint(1) NOT NULL DEFAULT '1' +); + +CREATE INDEX group_legend_phpbb_groups on phpbb_groups (group_legend); + +# Table: phpbb_icons CREATE TABLE phpbb_icons ( - icons_id INTEGER NOT NULL, - icons_url VARCHAR(50), - icons_width INTEGER NOT NULL, - icons_height INTEGER NOT NULL, - icons_order INTEGER NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL, - PRIMARY KEY (icons_id) + icons_id INTEGER PRIMARY KEY NOT NULL, + icons_url varchar(50), + icons_width tinyint(4) NOT NULL, + icons_height tinyint(4) NOT NULL, + icons_order tinyint(4) NOT NULL, + display_on_posting tinyint(1) NOT NULL DEFAULT '1' ); --- Table: 'phpbb_lang' +# Table: phpbb_lang CREATE TABLE phpbb_lang ( - lang_id INTEGER NOT NULL, - lang_iso VARCHAR(5) NOT NULL, - lang_dir VARCHAR(30) NOT NULL, - lang_english_name VARCHAR(30), - lang_local_name VARCHAR(100), - lang_author VARCHAR(100), - PRIMARY KEY (lang_id) + lang_id INTEGER PRIMARY KEY NOT NULL, + lang_iso varchar(5) NOT NULL, + lang_dir varchar(30) NOT NULL, + lang_english_name varchar(30), + lang_local_name varchar(100), + lang_author varchar(100) ); --- Table: 'phpbb_log' +# Table: phpbb_log CREATE TABLE phpbb_log ( - log_id INTEGER DEFAULT 0 NOT NULL, - log_type INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - log_ip VARCHAR(40) NOT NULL, - log_time INTEGER NOT NULL, - log_operation TEXT, - log_data TEXT, - PRIMARY KEY (log_id) -); - -CREATE INDEX log_type ON phpbb_log (log_type); -CREATE INDEX forum_id2 ON phpbb_log (forum_id); -CREATE INDEX topic_id ON phpbb_log (topic_id); -CREATE INDEX user_id3 ON phpbb_log (user_id); - --- Table: 'phpbb_moderator_cache' + log_id INTEGER PRIMARY KEY NOT NULL, + log_type tinyint(4) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + reportee_id mediumint(8) NOT NULL DEFAULT '0', + log_ip varchar(40) NOT NULL, + log_time int(11) NOT NULL, + log_operation text(65535), + log_data text(65535) +); + +CREATE INDEX log_type_phpbb_log on phpbb_log (log_type); +CREATE INDEX forum_id_phpbb_log on phpbb_log (forum_id); +CREATE INDEX topic_id_phpbb_log on phpbb_log (topic_id); +CREATE INDEX reportee_id_phpbb_log on phpbb_log (reportee_id); +CREATE INDEX user_id_phpbb_log on phpbb_log (user_id); + +# Table: phpbb_moderator_cache CREATE TABLE phpbb_moderator_cache ( - forum_id INTEGER NOT NULL, - user_id INTEGER, - username CHAR(30), - group_id INTEGER, - groupname CHAR(30), - display_on_index INTEGER DEFAULT 1 NOT NULL + forum_id mediumint(8) NOT NULL, + user_id mediumint(8) NOT NULL DEFAULT '0', + username char(30) NOT NULL DEFAULT '', + group_id mediumint(8) NOT NULL DEFAULT '0', + groupname char(30) NOT NULL DEFAULT '', + display_on_index tinyint(1) NOT NULL DEFAULT '1' ); -CREATE INDEX display_on_index ON phpbb_moderator_cache (display_on_index); -CREATE INDEX forum_id3 ON phpbb_moderator_cache (forum_id); +CREATE INDEX display_on_index_phpbb_moderat on phpbb_moderator_cache (display_on_index); +CREATE INDEX forum_id_phpbb_moderator_cache on phpbb_moderator_cache (forum_id); --- Table: 'phpbb_poll_results' +# Table: phpbb_modules +CREATE TABLE phpbb_modules ( + module_id INTEGER PRIMARY KEY NOT NULL, + module_type char(3) NOT NULL DEFAULT '', + module_title varchar(50) NOT NULL DEFAULT '', + module_filename varchar(50) NOT NULL DEFAULT '', + module_order mediumint(4) NOT NULL DEFAULT '0', + module_enabled tinyint(1) NOT NULL DEFAULT '1', + module_subs text(65535) NOT NULL, + module_acl varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX module_type_phpbb_modules on phpbb_modules (module_type, module_enabled); + +# Table: phpbb_poll_results CREATE TABLE phpbb_poll_results ( - poll_option_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_text VARCHAR(255) DEFAULT '' NOT NULL, - poll_option_total INTEGER DEFAULT 0 NOT NULL + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL, + poll_option_text varchar(255) NOT NULL, + poll_option_total mediumint(8) NOT NULL DEFAULT '0' ); -CREATE INDEX poll_option_id ON phpbb_poll_results (poll_option_id); -CREATE INDEX topic_id3 ON phpbb_poll_results (topic_id); +CREATE INDEX poll_option_id_phpbb_poll_resu on phpbb_poll_results (poll_option_id); +CREATE INDEX topic_id_phpbb_poll_results on phpbb_poll_results (topic_id); --- Table: 'phpbb_poll_voters' +# Table: phpbb_poll_voters CREATE TABLE phpbb_poll_voters ( - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_id INTEGER DEFAULT 0 NOT NULL, - vote_user_id INTEGER DEFAULT 0 NOT NULL, - vote_user_ip VARCHAR(40) DEFAULT '' NOT NULL + topic_id mediumint(8) NOT NULL DEFAULT '0', + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + vote_user_id mediumint(8) NOT NULL DEFAULT '0', + vote_user_ip varchar(40) NOT NULL ); -CREATE INDEX topic_id4 ON phpbb_poll_voters (topic_id); -CREATE INDEX vote_user_id ON phpbb_poll_voters (vote_user_id); -CREATE INDEX vote_user_ip ON phpbb_poll_voters (vote_user_ip); +CREATE INDEX topic_id_phpbb_poll_voters on phpbb_poll_voters (topic_id); +CREATE INDEX vote_user_id_phpbb_poll_voters on phpbb_poll_voters (vote_user_id); +CREATE INDEX vote_user_ip_phpbb_poll_voters on phpbb_poll_voters (vote_user_ip); --- Table: 'phpbb_posts' +# Table: phpbb_posts CREATE TABLE phpbb_posts ( - post_id INTEGER NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - poster_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 1 NOT NULL, - poster_ip VARCHAR(40) DEFAULT '' NOT NULL, - post_time INTEGER DEFAULT 0 NOT NULL, - post_approved INTEGER DEFAULT 1 NOT NULL, - post_reported INTEGER DEFAULT 0 NOT NULL, - enable_bbcode INTEGER DEFAULT 1 NOT NULL, - enable_html INTEGER DEFAULT 0 NOT NULL, - enable_smilies INTEGER DEFAULT 1 NOT NULL, - enable_magic_url INTEGER DEFAULT 1 NOT NULL, - enable_sig INTEGER DEFAULT 1 NOT NULL, - post_username VARCHAR(30) DEFAULT '', - post_subject VARCHAR(60) DEFAULT '', - post_text TEXT DEFAULT '' NOT NULL, - post_checksum VARCHAR(32) DEFAULT '' NOT NULL, - post_encoding VARCHAR(11) DEFAULT 'iso-8859-15' NOT NULL, - post_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, - bbcode_uid VARCHAR(10) DEFAULT '' NOT NULL, - post_edit_time INTEGER DEFAULT 0 NOT NULL, - post_edit_count INTEGER DEFAULT 0 NOT NULL, - post_edit_locked INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (post_id) -); - -CREATE INDEX forum_id4 ON phpbb_posts (forum_id); -CREATE INDEX topic_id5 ON phpbb_posts (topic_id); -CREATE INDEX poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX poster_id ON phpbb_posts (poster_id); -CREATE INDEX post_approved ON phpbb_posts (post_approved); - --- Table: 'phpbb_privmsgs' + post_id INTEGER PRIMARY KEY NOT NULL, + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id smallint(5) NOT NULL DEFAULT '0', + poster_id mediumint(8) NOT NULL DEFAULT '0', + icon_id tinyint(4) NOT NULL DEFAULT '1', + poster_ip varchar(40) NOT NULL, + post_time int(11) NOT NULL DEFAULT '0', + post_approved tinyint(1) NOT NULL DEFAULT '1', + post_reported tinyint(1) NOT NULL DEFAULT '0', + enable_bbcode tinyint(1) NOT NULL DEFAULT '1', + enable_html tinyint(1) NOT NULL DEFAULT '0', + enable_smilies tinyint(1) NOT NULL DEFAULT '1', + enable_magic_url tinyint(1) NOT NULL DEFAULT '1', + enable_sig tinyint(1) NOT NULL DEFAULT '1', + post_username varchar(30), + post_subject varchar(60), + post_text mediumtext(16777215), + post_checksum varchar(32) NOT NULL, + post_encoding varchar(11) NOT NULL DEFAULT 'iso-8859-15', + post_attachment tinyint(1) NOT NULL DEFAULT '0', + bbcode_bitfield int(11) NOT NULL DEFAULT '0', + bbcode_uid varchar(5) NOT NULL DEFAULT '', + post_edit_time int(11) NOT NULL DEFAULT '0', + post_edit_reason varchar(100), + post_edit_user mediumint(8) NOT NULL DEFAULT '0', + post_edit_count smallint(5) NOT NULL DEFAULT '0', + post_edit_locked tinyint(1) NOT NULL DEFAULT '0' +); + +CREATE INDEX forum_id_phpbb_posts on phpbb_posts (forum_id); +CREATE INDEX topic_id_phpbb_posts on phpbb_posts (topic_id); +CREATE INDEX poster_ip_phpbb_posts on phpbb_posts (poster_ip); +CREATE INDEX poster_id_phpbb_posts on phpbb_posts (poster_id); +CREATE INDEX post_approved_phpbb_posts on phpbb_posts (post_approved); +CREATE INDEX post_time_phpbb_posts on phpbb_posts (post_time); + +# Table: phpbb_privmsgs CREATE TABLE phpbb_privmsgs ( - privmsgs_id INTEGER NOT NULL, - privmsgs_attachment INTEGER DEFAULT 0 NOT NULL, - privmsgs_type INTEGER DEFAULT 0 NOT NULL, - privmsgs_subject VARCHAR(60) DEFAULT 0 NOT NULL, - privmsgs_from_userid INTEGER DEFAULT 0 NOT NULL, - privmsgs_to_userid INTEGER DEFAULT 0 NOT NULL, - privmsgs_date INTEGER DEFAULT 0 NOT NULL, - privmsgs_ip VARCHAR(40) NOT NULL, - privmsgs_enable_bbcode INTEGER DEFAULT 1 NOT NULL, - privmsgs_enable_html INTEGER DEFAULT 0 NOT NULL, - privmsgs_enable_smilies INTEGER DEFAULT 1 NOT NULL, - privmsgs_attach_sig INTEGER DEFAULT 1 NOT NULL, - privmsgs_text TEXT, - privmsgs_bbcode_uid VARCHAR(10) DEFAULT 0 NOT NULL, - PRIMARY KEY (privmsgs_id) -); - -CREATE INDEX privmsgs_from_userid ON phpbb_privmsgs (privmsgs_from_userid); -CREATE INDEX privmsgs_to_userid ON phpbb_privmsgs (privmsgs_to_userid); - --- Table: 'phpbb_ranks' + msg_id INTEGER PRIMARY KEY NOT NULL, + root_level mediumint(8) NOT NULL DEFAULT '0', + author_id mediumint(8) NOT NULL DEFAULT '0', + icon_id tinyint(4) NOT NULL DEFAULT '1', + author_ip varchar(40) NOT NULL DEFAULT '', + message_time int(11) NOT NULL DEFAULT '0', + message_reported tinyint(1) NOT NULL DEFAULT '0', + enable_bbcode tinyint(1) NOT NULL DEFAULT '1', + enable_html tinyint(1) NOT NULL DEFAULT '0', + enable_smilies tinyint(1) NOT NULL DEFAULT '1', + enable_magic_url tinyint(1) NOT NULL DEFAULT '1', + enable_sig tinyint(1) NOT NULL DEFAULT '1', + message_subject varchar(60), + message_text mediumtext(16777215), + message_edit_reason varchar(100), + message_edit_user mediumint(8) NOT NULL DEFAULT '0', + message_checksum varchar(32) NOT NULL DEFAULT '', + message_encoding varchar(11) NOT NULL DEFAULT 'iso-8859-15', + message_attachment tinyint(1) NOT NULL DEFAULT '0', + bbcode_bitfield int(11) NOT NULL DEFAULT '0', + bbcode_uid varchar(5) NOT NULL DEFAULT '', + message_edit_time int(11) NOT NULL DEFAULT '0', + message_edit_count smallint(5) NOT NULL DEFAULT '0', + to_address text(65535), + bcc_address text(65535) +); + +CREATE INDEX author_ip_phpbb_privmsgs on phpbb_privmsgs (author_ip); +CREATE INDEX message_time_phpbb_privmsgs on phpbb_privmsgs (message_time); +CREATE INDEX author_id_phpbb_privmsgs on phpbb_privmsgs (author_id); +CREATE INDEX root_level_phpbb_privmsgs on phpbb_privmsgs (root_level); + +# Table: phpbb_privmsgs_folder +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INTEGER PRIMARY KEY NOT NULL, + user_id mediumint(8) NOT NULL DEFAULT '0', + folder_name varchar(40) NOT NULL DEFAULT '', + pm_count mediumint(8) NOT NULL DEFAULT '0' +); + +CREATE INDEX user_id_phpbb_privmsgs_folder on phpbb_privmsgs_folder (user_id); + +# Table: phpbb_privmsgs_rules +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INTEGER PRIMARY KEY NOT NULL, + user_id mediumint(8) NOT NULL DEFAULT '0', + rule_check mediumint(4) NOT NULL DEFAULT '0', + rule_connection mediumint(4) NOT NULL DEFAULT '0', + rule_string varchar(255) NOT NULL DEFAULT '', + rule_user_id mediumint(8) NOT NULL DEFAULT '0', + rule_group_id mediumint(8) NOT NULL DEFAULT '0', + rule_action mediumint(4) NOT NULL DEFAULT '0', + rule_folder_id mediumint(8) NOT NULL DEFAULT '0' +); + +# Table: phpbb_privmsgs_to +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + author_id mediumint(8) NOT NULL DEFAULT '0', + deleted tinyint(1) NOT NULL DEFAULT '0', + new tinyint(1) NOT NULL DEFAULT '1', + unread tinyint(1) NOT NULL DEFAULT '1', + replied tinyint(1) NOT NULL DEFAULT '0', + marked tinyint(1) NOT NULL DEFAULT '0', + forwarded tinyint(1) NOT NULL DEFAULT '0', + folder_id int(10) NOT NULL DEFAULT '0' +); + +CREATE INDEX msg_id_phpbb_privmsgs_to on phpbb_privmsgs_to (msg_id); +CREATE INDEX user_id_phpbb_privmsgs_to on phpbb_privmsgs_to (user_id, folder_id); + +# Table: phpbb_profile_fields +CREATE TABLE phpbb_profile_fields ( + field_id INTEGER PRIMARY KEY NOT NULL, + field_name varchar(50) NOT NULL DEFAULT '', + field_desc varchar(255) NOT NULL DEFAULT '', + field_type mediumint(8) NOT NULL, + 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 '0', + field_validation varchar(20) NOT NULL DEFAULT '', + field_required tinyint(1) NOT NULL DEFAULT '0', + field_show_on_reg tinyint(1) NOT NULL DEFAULT '0', + field_hide tinyint(1) NOT NULL DEFAULT '0', + field_no_view tinyint(1) NOT NULL DEFAULT '0', + field_active tinyint(1) NOT NULL DEFAULT '0', + field_order tinyint(4) NOT NULL DEFAULT '0' +); + +CREATE INDEX field_type_phpbb_profile_field on phpbb_profile_fields (field_type); +CREATE INDEX field_order_phpbb_profile_fiel on phpbb_profile_fields (field_order); + +# Table: phpbb_profile_fields_data +CREATE TABLE phpbb_profile_fields_data ( + user_id INTEGER PRIMARY KEY NOT NULL DEFAULT '0' +); + +# Table: phpbb_profile_fields_lang +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) NOT NULL DEFAULT '0', + lang_id mediumint(8) NOT NULL DEFAULT '0', + option_id mediumint(8) NOT NULL DEFAULT '0', + field_type tinyint(4) NOT NULL DEFAULT '0', + 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 mediumint(8) NOT NULL DEFAULT '0', + lang_id tinyint(4) NOT NULL DEFAULT '0', + lang_name varchar(255) NOT NULL DEFAULT '', + lang_explain text(65535) NOT NULL, + 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, - rank_title VARCHAR(50) NOT NULL, - rank_min INTEGER DEFAULT 0 NOT NULL, - rank_special INTEGER DEFAULT 0, - rank_image VARCHAR(100), - PRIMARY KEY (rank_id) + rank_id INTEGER PRIMARY KEY NOT NULL, + rank_title varchar(50) NOT NULL, + rank_min mediumint(8) NOT NULL DEFAULT '0', + rank_special tinyint(1) DEFAULT '0', + rank_image varchar(100) ); --- Table: 'phpbb_reports_reasons' +# Table: phpbb_reports_reasons CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER NOT NULL, - reason_priority INTEGER DEFAULT 0 NOT NULL, - reason_name VARCHAR(255) DEFAULT '' NOT NULL, - reason_description TEXT NOT NULL, - PRIMARY KEY (reason_id) + reason_id INTEGER PRIMARY KEY NOT NULL, + reason_priority tinyint(4) NOT NULL DEFAULT '0', + reason_name varchar(255) NOT NULL DEFAULT '', + reason_description text(65535) NOT NULL ); --- Table: 'phpbb_reports' +# Table: phpbb_reports CREATE TABLE phpbb_reports ( - report_id INTEGER NOT NULL, - reason_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - report_time INTEGER DEFAULT 0 NOT NULL, - report_text TEXT NOT NULL, - PRIMARY KEY (report_id) + report_id INTEGER PRIMARY KEY NOT NULL, + reason_id smallint(5) NOT NULL DEFAULT '0', + post_id mediumint(8) NOT NULL DEFAULT '0', + msg_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + user_notify tinyint(1) NOT NULL DEFAULT '0', + report_time int(10) NOT NULL DEFAULT '0', + report_text text(65535) NOT NULL ); --- Table: phpbb_search_results +# Table: phpbb_search_results CREATE TABLE phpbb_search_results ( - search_id INTEGER DEFAULT 0 NOT NULL, - session_id VARCHAR(32) DEFAULT '' NOT NULL, - search_array TEXT NOT NULL, - PRIMARY KEY (search_id) + search_id INTEGER PRIMARY KEY NOT NULL DEFAULT '0', + session_id varchar(32) NOT NULL DEFAULT '', + search_time int(11) NOT NULL DEFAULT '0', + search_array mediumtext(16777215) NOT NULL ); -CREATE INDEX session_id ON phpbb_search_results (session_id); +CREATE INDEX session_id_phpbb_search_result on phpbb_search_results (session_id); --- Table: phpbb_search_wordlist +# Table: phpbb_search_wordlist CREATE TABLE phpbb_search_wordlist ( - word_id INTEGER NOT NULL, - word_text VARCHAR(50) DEFAULT '' NOT NULL, - word_common INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (word_id) + word_text varchar(50) NOT NULL DEFAULT '', + word_id mediumint NOT NULL, + word_common tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (word_text) ); -CREATE INDEX word_id ON phpbb_search_wordlist (word_id); +CREATE INDEX word_id_phpbb_search_wordlist on phpbb_search_wordlist (word_id); --- Table: phpbb_search_wordmatch +# Table: phpbb_search_wordmatch CREATE TABLE phpbb_search_wordmatch ( - post_id INTEGER DEFAULT 0 NOT NULL, - word_id INTEGER DEFAULT 0 NOT NULL, - title_match INTEGER DEFAULT 0 NOT NULL + post_id mediumint(8) NOT NULL DEFAULT '0', + word_id mediumint(8) NOT NULL DEFAULT '0', + title_match tinyint(1) NOT NULL DEFAULT '0' ); -CREATE INDEX word_id2 ON phpbb_search_wordmatch (word_id); +CREATE INDEX word_id_phpbb_search_wordmatch on phpbb_search_wordmatch (word_id); --- Table: 'phpbb_sessions' +# Table: phpbb_sessions CREATE TABLE phpbb_sessions ( - session_id VARCHAR(32) DEFAULT '' NOT NULL, - session_user_id INTEGER DEFAULT 0 NOT NULL, - session_last_visit INTEGER DEFAULT 0 NOT NULL, - session_start INTEGER DEFAULT 0 NOT NULL, - session_time INTEGER DEFAULT 0 NOT NULL, - session_ip VARCHAR(40) DEFAULT 0 NOT NULL, - session_browser VARCHAR(100) DEFAULT '' NOT NULL, - session_page VARCHAR(100) DEFAULT 0 NOT NULL, - session_allow_viewonline INTEGER DEFAULT 1 NOT NULL, - PRIMARY KEY (session_id) + session_id varchar(32) NOT NULL DEFAULT '', + session_user_id mediumint(8) NOT NULL DEFAULT '0', + session_last_visit int(11) NOT NULL DEFAULT '0', + session_start int(11) NOT NULL DEFAULT '0', + session_time int(11) NOT NULL DEFAULT '0', + session_ip varchar(40) NOT NULL DEFAULT '0', + session_browser varchar(100) NOT NULL DEFAULT '', + session_page varchar(100) NOT NULL DEFAULT '', + session_viewonline tinyint(1) NOT NULL DEFAULT '1', + session_admin tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (session_id) +); + +CREATE INDEX session_time_phpbb_sessions on phpbb_sessions (session_time); +CREATE INDEX session_user_id_phpbb_sessions on phpbb_sessions (session_user_id); + +# Table: phpbb_sitelist +CREATE TABLE phpbb_sitelist ( + site_id INTEGER PRIMARY KEY NOT NULL, + site_ip varchar(40) NOT NULL DEFAULT '', + site_hostname varchar(255) NOT NULL DEFAULT '', + ip_exclude tinyint(1) NOT NULL DEFAULT '0' +); + +# Table: phpbb_smilies +CREATE TABLE phpbb_smilies ( + smiley_id INTEGER PRIMARY KEY NOT NULL, + code char(10), + emotion char(50), + smiley_url char(50), + smiley_width tinyint(4) NOT NULL, + smiley_height tinyint(4) NOT NULL, + smiley_order tinyint(4) NOT NULL, + display_on_posting tinyint(1) NOT NULL DEFAULT '1' ); -CREATE INDEX session_time ON phpbb_sessions (session_time); - --- Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smile_id INTEGER NOT NULL, - code CHAR(10) DEFAULT '' NOT NULL, - emoticon CHAR(50) DEFAULT '' NOT NULL, - smile_url CHAR(50) DEFAULT '' NOT NULL, - smile_width INTEGER DEFAULT 0 NOT NULL, - smile_height INTEGER DEFAULT 0 NOT NULL, - smile_order INTEGER DEFAULT 1 NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL, - PRIMARY KEY (smile_id) -); - --- Table: 'phpbb_styles' +# Table: phpbb_styles CREATE TABLE phpbb_styles ( - style_id INTEGER NOT NULL, - template_id CHAR(50) DEFAULT '' NOT NULL, - theme_id INTEGER DEFAULT 0 NOT NULL, - imageset_id INTEGER DEFAULT 0 NOT NULL, - style_name CHAR(30) DEFAULT '' NOT NULL, - PRIMARY KEY (style_id) + style_id INTEGER PRIMARY KEY NOT NULL, + style_name varchar(30) NOT NULL DEFAULT '', + style_copyright varchar(50) NOT NULL DEFAULT '', + style_active tinyint(1) NOT NULL DEFAULT '1', + template_id tinyint(4) NOT NULL, + theme_id tinyint(4) NOT NULL, + imageset_id tinyint(4) NOT NULL ); -CREATE INDEX template_id ON phpbb_styles (template_id); -CREATE INDEX theme_id ON phpbb_styles (theme_id); -CREATE INDEX imageset_id ON phpbb_styles (imageset_id); +CREATE INDEX B_phpbb_styles on phpbb_styles (template_id); +CREATE INDEX C_phpbb_styles on phpbb_styles (theme_id); +CREATE INDEX D_phpbb_styles on phpbb_styles (imageset_id); +CREATE UNIQUE INDEX style_name_phpbb_styles on phpbb_styles (style_name); --- Table: 'phpbb_styles_template' +# Table: phpbb_styles_template CREATE TABLE phpbb_styles_template ( - template_id INTEGER NOT NULL, - template_name CHAR(30) DEFAULT '' NOT NULL, - template_path CHAR(50) DEFAULT '' NOT NULL, - poll_length INTEGER DEFAULT 0 NOT NULL, - pm_box_length INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield INT DEFAULT 0 NOT NULL, - PRIMARY KEY (template_id) + template_id INTEGER PRIMARY KEY NOT NULL, + template_name varchar(30) NOT NULL, + template_copyright varchar(50) NOT NULL, + template_path varchar(30) NOT NULL, + bbcode_bitfield int(11) NOT NULL DEFAULT '0', + template_storedb tinyint(1) NOT NULL DEFAULT '0' ); --- Table: 'phpbb_styles_theme' +CREATE UNIQUE INDEX template_name_phpbb_styles_tem on phpbb_styles_template (template_name); + +# Table: phpbb_styles_template_data +CREATE TABLE phpbb_styles_template_data ( + template_id tinyint(4) NOT NULL, + template_filename varchar(50) NOT NULL DEFAULT '', + template_included text(65535) NOT NULL, + template_mtime int(11) NOT NULL DEFAULT '0', + template_data mediumtext(16777215) +); + +CREATE INDEX B_phpbb_styles_template_data on phpbb_styles_template_data (template_id); +CREATE INDEX C_phpbb_styles_template_data on phpbb_styles_template_data (template_filename); + +# Table: phpbb_styles_theme CREATE TABLE phpbb_styles_theme ( - theme_id INTEGER NOT NULL, - theme_name CHAR(60) DEFAULT '' NOT NULL, - css_external CHAR(100) DEFAULT '' NOT NULL, - css_data TEXT, - PRIMARY KEY (theme_id) + theme_id INTEGER PRIMARY KEY NOT NULL, + theme_name varchar(30) NOT NULL DEFAULT '', + theme_copyright varchar(50) NOT NULL DEFAULT '', + theme_path varchar(30) NOT NULL DEFAULT '', + theme_storedb tinyint(1) NOT NULL DEFAULT '0', + theme_mtime int(11) NOT NULL DEFAULT '0', + theme_data mediumtext(16777215) NOT NULL DEFAULT '' ); --- Table: 'phpbb_styles_imageset' +CREATE UNIQUE INDEX theme_name_phpbb_styles_theme on phpbb_styles_theme (theme_name); + +# Table: phpbb_styles_imageset CREATE TABLE phpbb_styles_imageset ( - imageset_id INTEGER NOT NULL, - imageset_name CHAR(100), - imageset_path CHAR(30), - btn_post CHAR(200) DEFAULT '' NOT NULL, - btn_post_pm CHAR(200) DEFAULT '' NOT NULL, - btn_reply CHAR(200) DEFAULT '' NOT NULL, - btn_reply_pm CHAR(200) DEFAULT '' NOT NULL, - btn_locked CHAR(200) DEFAULT '' NOT NULL, - btn_profile CHAR(200) DEFAULT '' NOT NULL, - btn_pm CHAR(200) DEFAULT '' NOT NULL, - btn_delete CHAR(200) DEFAULT '' NOT NULL, - btn_ip CHAR(200) DEFAULT '' NOT NULL, - btn_quote CHAR(200) DEFAULT '' NOT NULL, - btn_search CHAR(200) DEFAULT '' NOT NULL, - btn_edit CHAR(200) DEFAULT '' NOT NULL, - btn_report CHAR(200) DEFAULT '' NOT NULL, - btn_email CHAR(200) DEFAULT '' NOT NULL, - btn_www CHAR(200) DEFAULT '' NOT NULL, - btn_icq CHAR(200) DEFAULT '' NOT NULL, - btn_aim CHAR(200) DEFAULT '' NOT NULL, - btn_yim CHAR(200) DEFAULT '' NOT NULL, - btn_msnm CHAR(200) DEFAULT '' NOT NULL, - btn_jabber CHAR(200) DEFAULT '' NOT NULL, - btn_online CHAR(200) DEFAULT '' NOT NULL, - btn_offline CHAR(200) DEFAULT '' NOT NULL, - btn_topic_watch CHAR(200) DEFAULT '' NOT NULL, - btn_topic_unwatch CHAR(200) DEFAULT '' NOT NULL, - icon_unapproved CHAR(200) DEFAULT '' NOT NULL, - icon_reported CHAR(200) DEFAULT '' NOT NULL, - icon_attach CHAR(200) DEFAULT '' NOT NULL, - icon_post CHAR(200) DEFAULT '' NOT NULL, - icon_post_new CHAR(200) DEFAULT '' NOT NULL, - icon_post_latest CHAR(200) DEFAULT '' NOT NULL, - icon_post_newest CHAR(200) DEFAULT '' NOT NULL, - forum CHAR(200) DEFAULT '' NOT NULL, - forum_new CHAR(200) DEFAULT '' NOT NULL, - forum_locked CHAR(200) DEFAULT '' NOT NULL, - forum_link CHAR(200) DEFAULT '' NOT NULL, - sub_forum CHAR(200) DEFAULT '' NOT NULL, - sub_forum_new CHAR(200) DEFAULT '' NOT NULL, - folder CHAR(200) DEFAULT '' NOT NULL, - folder_posted CHAR(200) DEFAULT '' NOT NULL, - folder_new CHAR(200) DEFAULT '' NOT NULL, - folder_new_posted CHAR(200) DEFAULT '' NOT NULL, - folder_hot CHAR(200) DEFAULT '' NOT NULL, - folder_hot_posted CHAR(200) DEFAULT '' NOT NULL, - folder_hot_new CHAR(200) DEFAULT '' NOT NULL, - folder_hot_new_posted CHAR(200) DEFAULT '' NOT NULL, - folder_locked CHAR(200) DEFAULT '' NOT NULL, - folder_locked_posted CHAR(200) DEFAULT '' NOT NULL, - folder_locked_new CHAR(200) DEFAULT '' NOT NULL, - folder_locked_new_posted CHAR(200) DEFAULT '' NOT NULL, - folder_sticky CHAR(200) DEFAULT '' NOT NULL, - folder_sticky_posted CHAR(200) DEFAULT '' NOT NULL, - folder_sticky_new CHAR(200) DEFAULT '' NOT NULL, - folder_sticky_new_posted CHAR(200) DEFAULT '' NOT NULL, - folder_announce CHAR(200) DEFAULT '' NOT NULL, - folder_announce_posted CHAR(200) DEFAULT '' NOT NULL, - folder_announce_new CHAR(200) DEFAULT '' NOT NULL, - folder_announce_new_posted CHAR(200) DEFAULT '' NOT NULL, - poll_left CHAR(200) DEFAULT '' NOT NULL, - poll_center CHAR(200) DEFAULT '' NOT NULL, - poll_right CHAR(200) DEFAULT '' NOT NULL, - PRIMARY KEY (imageset_id) -); - --- Table: 'phpbb_topics' + imageset_id INTEGER PRIMARY KEY NOT NULL, + imageset_name varchar(30) NOT NULL DEFAULT '', + imageset_copyright varchar(50) NOT NULL DEFAULT '', + imageset_path varchar(30) NOT NULL DEFAULT '', + site_logo varchar(200) NOT NULL DEFAULT '', + btn_post varchar(200) NOT NULL DEFAULT '', + btn_post_pm varchar(200) NOT NULL DEFAULT '', + btn_reply varchar(200) NOT NULL DEFAULT '', + btn_reply_pm varchar(200) NOT NULL DEFAULT '', + btn_locked varchar(200) NOT NULL DEFAULT '', + btn_profile varchar(200) NOT NULL DEFAULT '', + btn_pm varchar(200) NOT NULL DEFAULT '', + btn_delete varchar(200) NOT NULL DEFAULT '', + btn_info varchar(200) NOT NULL DEFAULT '', + btn_quote varchar(200) NOT NULL DEFAULT '', + btn_search varchar(200) NOT NULL DEFAULT '', + btn_edit varchar(200) NOT NULL DEFAULT '', + btn_report varchar(200) NOT NULL DEFAULT '', + btn_email varchar(200) NOT NULL DEFAULT '', + btn_www varchar(200) NOT NULL DEFAULT '', + btn_icq varchar(200) NOT NULL DEFAULT '', + btn_aim varchar(200) NOT NULL DEFAULT '', + btn_yim varchar(200) NOT NULL DEFAULT '', + btn_msnm varchar(200) NOT NULL DEFAULT '', + btn_jabber varchar(200) NOT NULL DEFAULT '', + btn_online varchar(200) NOT NULL DEFAULT '', + btn_offline varchar(200) NOT NULL DEFAULT '', + btn_friend varchar(200) NOT NULL DEFAULT '', + btn_foe varchar(200) NOT NULL DEFAULT '', + icon_unapproved varchar(200) NOT NULL DEFAULT '', + icon_reported varchar(200) NOT NULL DEFAULT '', + icon_attach varchar(200) NOT NULL DEFAULT '', + icon_post varchar(200) NOT NULL DEFAULT '', + icon_post_new varchar(200) NOT NULL DEFAULT '', + icon_post_latest varchar(200) NOT NULL DEFAULT '', + icon_post_newest varchar(200) NOT NULL DEFAULT '', + forum varchar(200) NOT NULL DEFAULT '', + forum_new varchar(200) NOT NULL DEFAULT '', + forum_locked varchar(200) NOT NULL DEFAULT '', + forum_link varchar(200) NOT NULL DEFAULT '', + sub_forum varchar(200) NOT NULL DEFAULT '', + sub_forum_new varchar(200) NOT NULL DEFAULT '', + folder varchar(200) NOT NULL DEFAULT '', + folder_moved varchar(200) NOT NULL DEFAULT '', + folder_posted varchar(200) NOT NULL DEFAULT '', + folder_new varchar(200) NOT NULL DEFAULT '', + folder_new_posted varchar(200) NOT NULL DEFAULT '', + folder_hot varchar(200) NOT NULL DEFAULT '', + folder_hot_posted varchar(200) NOT NULL DEFAULT '', + folder_hot_new varchar(200) NOT NULL DEFAULT '', + folder_hot_new_posted varchar(200) NOT NULL DEFAULT '', + folder_locked varchar(200) NOT NULL DEFAULT '', + folder_locked_posted varchar(200) NOT NULL DEFAULT '', + folder_locked_new varchar(200) NOT NULL DEFAULT '', + folder_locked_new_posted varchar(200) NOT NULL DEFAULT '', + folder_sticky varchar(200) NOT NULL DEFAULT '', + folder_sticky_posted varchar(200) NOT NULL DEFAULT '', + folder_sticky_new varchar(200) NOT NULL DEFAULT '', + folder_sticky_new_posted varchar(200) NOT NULL DEFAULT '', + folder_announce varchar(200) NOT NULL DEFAULT '', + folder_announce_posted varchar(200) NOT NULL DEFAULT '', + folder_announce_new varchar(200) NOT NULL DEFAULT '', + folder_announce_new_posted varchar(200) NOT NULL DEFAULT '', + folder_global varchar(200) NOT NULL DEFAULT '', + folder_global_posted varchar(200) NOT NULL DEFAULT '', + folder_global_new varchar(200) NOT NULL DEFAULT '', + folder_global_new_posted varchar(200) NOT NULL DEFAULT '', + poll_left varchar(200) NOT NULL DEFAULT '', + poll_center varchar(200) NOT NULL DEFAULT '', + poll_right varchar(200) NOT NULL DEFAULT '', + attach_progress_bar varchar(200) NOT NULL DEFAULT '', + user_icon1 varchar(200) NOT NULL DEFAULT '', + user_icon2 varchar(200) NOT NULL DEFAULT '', + user_icon3 varchar(200) NOT NULL DEFAULT '', + user_icon4 varchar(200) NOT NULL DEFAULT '', + user_icon5 varchar(200) NOT NULL DEFAULT '', + user_icon6 varchar(200) NOT NULL DEFAULT '', + user_icon7 varchar(200) NOT NULL DEFAULT '', + user_icon8 varchar(200) NOT NULL DEFAULT '', + user_icon9 varchar(200) NOT NULL DEFAULT '', + user_icon10 varchar(200) NOT NULL DEFAULT '' +); + +CREATE UNIQUE INDEX imageset_name_phpbb_styles_ima on phpbb_styles_imageset (imageset_name); + +# Table: phpbb_topics CREATE TABLE phpbb_topics ( - topic_id INTEGER NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 1 NOT NULL, - topic_attachment INTEGER DEFAULT 0 NOT NULL, - topic_approved INTEGER DEFAULT 1 NOT NULL, - topic_reported INTEGER DEFAULT 0 NOT NULL, - topic_title VARCHAR(60) NOT NULL, - topic_poster INTEGER DEFAULT 0 NOT NULL, - topic_time INTEGER DEFAULT 0 NOT NULL, - topic_views INTEGER DEFAULT 0 NOT NULL, - topic_replies INTEGER DEFAULT 0 NOT NULL, - topic_replies_real INTEGER DEFAULT 0 NOT NULL, - topic_status INTEGER DEFAULT 0 NOT NULL, - topic_type INTEGER DEFAULT 0 NOT NULL, - topic_first_post_id INTEGER DEFAULT 0 NOT NULL, - topic_first_poster_name VARCHAR(30), - topic_last_post_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_name VARCHAR(30), - topic_last_post_time INTEGER DEFAULT 0 NOT NULL, - topic_last_view_time INTEGER DEFAULT 0 NOT NULL, - topic_moved_id INTEGER DEFAULT 0 NOT NULL, - poll_title VARCHAR(255) DEFAULT '' NOT NULL, - poll_start INTEGER DEFAULT 0 NOT NULL, - poll_length INTEGER DEFAULT 0 NOT NULL, - poll_max_options INTEGER DEFAULT 1 NOT NULL, - poll_last_vote INTEGER, - PRIMARY KEY (topic_id) -); - -CREATE INDEX forum_id5 ON phpbb_topics (forum_id); -CREATE INDEX forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX topic_last_post_time ON phpbb_topics (topic_last_post_time); - --- Table: 'phpbb_topic_marking' + topic_id INTEGER PRIMARY KEY NOT NULL, + forum_id smallint(8) NOT NULL DEFAULT '0', + icon_id tinyint(4) NOT NULL DEFAULT '1', + topic_attachment tinyint(1) NOT NULL DEFAULT '0', + topic_approved tinyint(1) NOT NULL DEFAULT '1', + topic_reported tinyint(1) NOT NULL DEFAULT '0', + topic_title varchar(60) NOT NULL, + topic_poster mediumint(8) NOT NULL DEFAULT '0', + topic_time int(11) NOT NULL DEFAULT '0', + topic_time_limit int(11) NOT NULL DEFAULT '0', + topic_views mediumint(8) NOT NULL DEFAULT '0', + topic_replies mediumint(8) NOT NULL DEFAULT '0', + topic_replies_real mediumint(8) NOT NULL DEFAULT '0', + topic_status tinyint(3) NOT NULL DEFAULT '0', + topic_type tinyint(3) NOT NULL DEFAULT '0', + topic_first_post_id mediumint(8) NOT NULL DEFAULT '0', + topic_first_poster_name varchar(30), + topic_last_post_id mediumint(8) NOT NULL DEFAULT '0', + topic_last_poster_id mediumint(8) NOT NULL DEFAULT '0', + topic_last_poster_name varchar(30), + topic_last_post_time int(11) NOT NULL DEFAULT '0', + topic_last_view_time int(11) NOT NULL DEFAULT '0', + topic_moved_id mediumint(8) NOT NULL DEFAULT '0', + topic_bumped tinyint(1) NOT NULL DEFAULT '0', + topic_bumper mediumint(8) NOT NULL DEFAULT '0', + poll_title varchar(255) NOT NULL, + poll_start int(11) NOT NULL DEFAULT '0', + poll_length int(11) NOT NULL DEFAULT '0', + poll_max_options tinyint(4) NOT NULL DEFAULT '1', + poll_last_vote int(11) DEFAULT '0', + poll_vote_change tinyint(1) NOT NULL DEFAULT '0' +); + +CREATE INDEX forum_id_phpbb_topics on phpbb_topics (forum_id); +CREATE INDEX forum_id_type_phpbb_topics on phpbb_topics (forum_id, topic_type); +CREATE INDEX topic_last_post_time_phpbb_top on phpbb_topics (topic_last_post_time); + +# Table: phpbb_topics_marking CREATE TABLE phpbb_topics_marking ( - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - mark_type INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (user_id, topic_id) + user_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + mark_type tinyint(4) NOT NULL DEFAULT '0', + mark_time int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) ); --- Table: 'phpbb_topics_watch' +# Table: phpbb_topics_watch CREATE TABLE phpbb_topics_watch ( - topic_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL + topic_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL DEFAULT '0' ); -CREATE INDEX topic_id6 ON phpbb_topics_watch (topic_id); -CREATE INDEX user_id5 ON phpbb_topics_watch (user_id); -CREATE INDEX notify_status2 ON phpbb_topics_watch (notify_status); +CREATE INDEX topic_id_phpbb_topics_watch on phpbb_topics_watch (topic_id); +CREATE INDEX user_id_phpbb_topics_watch on phpbb_topics_watch (user_id); +CREATE INDEX notify_status_phpbb_topics_wat on phpbb_topics_watch (notify_status); --- Table: 'phpbb_ucp_modules' -CREATE TABLE phpbb_ucp_modules ( - module_id INTEGER DEFAULT 0 NOT NULL, - module_title VARCHAR(50) DEFAULT '' NOT NULL, - module_filename VARCHAR(50) DEFAULT '' NOT NULL, - module_order INTEGER DEFAULT 0 NOT NULL, - PRIMARY KEY (module_id) -); - --- Table: 'phpbb_user_group' +# Table: phpbb_user_group CREATE TABLE phpbb_user_group ( - group_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - user_pending INTEGER + group_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + group_leader tinyint(1) NOT NULL DEFAULT '0', + user_pending tinyint(1) ); -CREATE INDEX group_id2 ON phpbb_user_group (group_id); -CREATE INDEX user_id6 ON phpbb_user_group (user_id); +CREATE INDEX group_id_phpbb_user_group on phpbb_user_group (group_id); +CREATE INDEX user_id_phpbb_user_group on phpbb_user_group (user_id); +CREATE INDEX group_leader_phpbb_user_group on phpbb_user_group (group_leader); --- Table: 'phpbb_users' +# Table: phpbb_users CREATE TABLE phpbb_users ( - user_id INTEGER NOT NULL, - user_active INTEGER DEFAULT 1 NOT NULL, - user_founder INTEGER DEFAULT 0 NOT NULL, - group_id INTEGER DEFAULT 0 NOT NULL, - user_permissions TEXT DEFAULT '', - user_ip VARCHAR(40), - user_regdate INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(30) NOT NULL, - user_password VARCHAR(32) NOT NULL, - user_email VARCHAR(60), - user_birthday VARCHAR(10) DEFAULT '' NOT NULL, - user_lastvisit INTEGER DEFAULT 0 NOT NULL, - user_lastpage VARCHAR(100) DEFAULT '' NOT NULL, - user_karma INTEGER DEFAULT '3' NOT NULL, - user_min_karma INTEGER DEFAULT '-5' NOT NULL, - user_startpage VARCHAR(100) DEFAULT '', - user_colour VARCHAR(6) DEFAULT '' NOT NULL, - user_posts INTEGER DEFAULT 0 NOT NULL, - user_lang VARCHAR(30) DEFAULT '' NOT NULL, - user_timezone decimal(5,2) DEFAULT 0 NOT NULL, - user_dst INTEGER DEFAULT 0 NOT NULL, - user_dateformat VARCHAR(15) DEFAULT 'd M Y H:i' NOT NULL, - user_style INTEGER DEFAULT 1 NOT NULL, - user_rank INTEGER DEFAULT 0 NOT NULL, - user_new_privmsg INTEGER DEFAULT 0 NOT NULL, - user_unread_privmsg INTEGER DEFAULT 0 NOT NULL, - user_last_privmsg INTEGER DEFAULT 0 NOT NULL, - user_emailtime INTEGER, - user_sortby_type VARCHAR(1) DEFAULT '' NOT NULL, - user_sortby_dir VARCHAR(1) DEFAULT '' NOT NULL, - user_show_days INTEGER DEFAULT 0 NOT NULL, - user_viewimg INTEGER DEFAULT 1 NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - user_notify_pm INTEGER DEFAULT 1 NOT NULL, - user_popup_pm INTEGER DEFAULT 0 NOT NULL, - user_viewflash INTEGER DEFAULT 1 NOT NULL, - user_viewsmilies INTEGER DEFAULT 1 NOT NULL, - user_viewsigs INTEGER DEFAULT 1 NOT NULL, - user_viewavatars INTEGER DEFAULT 1 NOT NULL, - user_viewcensors INTEGER DEFAULT 1 NOT NULL, - user_attachsig INTEGER DEFAULT 1 NOT NULL, - user_allowhtml INTEGER DEFAULT 1 NOT NULL, - user_allowbbcode INTEGER DEFAULT 1 NOT NULL, - user_allowsmile INTEGER DEFAULT 1 NOT NULL, - user_allowavatar INTEGER DEFAULT 1 NOT NULL, - user_allow_pm INTEGER DEFAULT 1 NOT NULL, - user_allow_email INTEGER DEFAULT 1 NOT NULL, - user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, - user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, - user_allow_massemail INTEGER DEFAULT 1 NOT NULL, - user_avatar VARCHAR(100) DEFAULT '' NOT NULL, - user_avatar_type INTEGER DEFAULT 0 NOT NULL, - user_avatar_width INTEGER DEFAULT 0 NOT NULL, - user_avatar_height INTEGER DEFAULT 0 NOT NULL, - user_sig TEXT, - user_sig_bbcode_uid VARCHAR(5) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, - user_from VARCHAR(100) DEFAULT '' NOT NULL, - user_icq VARCHAR(15) DEFAULT '' NOT NULL, - user_aim VARCHAR(255) DEFAULT '' NOT NULL, - user_yim VARCHAR(255) DEFAULT '' NOT NULL, - user_msnm VARCHAR(255) DEFAULT '' NOT NULL, - user_jabber VARCHAR(255) DEFAULT '' NOT NULL, - user_website VARCHAR(100) DEFAULT '' NOT NULL, - user_actkey VARCHAR(32) DEFAULT '' NOT NULL, - user_newpasswd VARCHAR(32) DEFAULT '' NOT NULL, - user_occ VARCHAR(255) DEFAULT '' NOT NULL, - user_interests VARCHAR(255) DEFAULT '' NOT NULL, - PRIMARY KEY (user_id) -); - -CREATE INDEX user_birthday ON phpbb_users (user_birthday); - --- Table: 'phpbb_words' + user_id INTEGER PRIMARY KEY NOT NULL, + user_type tinyint(1) NOT NULL DEFAULT '0', + group_id mediumint(8) NOT NULL DEFAULT '3', + user_permissions text(65535) NOT NULL DEFAULT '', + user_ip varchar(40) NOT NULL DEFAULT '', + user_regdate int(11) NOT NULL DEFAULT '0', + username varchar(30) NOT NULL DEFAULT '', + user_password varchar(32) NOT NULL DEFAULT '', + user_passchg int(11) NOT NULL DEFAULT '0', + user_email varchar(60) NOT NULL DEFAULT '', + user_email_hash bigint(20) NOT NULL DEFAULT '0', + user_birthday varchar(10) NOT NULL DEFAULT '', + user_lastvisit int(11) NOT NULL DEFAULT '0', + user_lastpost_time int(11) NOT NULL DEFAULT '0', + user_lastpage varchar(100) NOT NULL DEFAULT '', + user_last_confirm_key varchar(10) NOT NULL DEFAULT '', + user_warnings tinyint(4) NOT NULL DEFAULT '0', + user_posts mediumint(8) NOT NULL DEFAULT '0', + user_lang varchar(30) NOT NULL DEFAULT '', + user_timezone decimal(5,2) NOT NULL DEFAULT '0.0', + user_dst tinyint(1) NOT NULL DEFAULT '0', + user_dateformat varchar(15) NOT NULL DEFAULT 'd M Y H:i', + user_style tinyint(4) NOT NULL DEFAULT '0', + user_rank int(11) DEFAULT '0', + user_colour varchar(6) NOT NULL DEFAULT '', + user_new_privmsg tinyint(4) NOT NULL DEFAULT '0', + user_unread_privmsg tinyint(4) NOT NULL DEFAULT '0', + user_last_privmsg int(11) NOT NULL DEFAULT '0', + user_message_rules tinyint(1) NOT NULL DEFAULT '0', + user_full_folder int(11) NOT NULL DEFAULT '-3', + user_emailtime int(11) NOT NULL DEFAULT '0', + user_topic_show_days smallint(4) NOT NULL DEFAULT '0', + user_topic_sortby_type varchar(1) NOT NULL DEFAULT '', + user_topic_sortby_dir varchar(1) NOT NULL DEFAULT '', + user_post_show_days smallint(4) NOT NULL DEFAULT '0', + user_post_sortby_type varchar(1) NOT NULL DEFAULT '', + user_post_sortby_dir varchar(1) NOT NULL DEFAULT '', + user_notify tinyint(1) NOT NULL DEFAULT '0', + user_notify_pm tinyint(1) NOT NULL DEFAULT '1', + user_notify_type tinyint(4) NOT NULL DEFAULT '0', + user_allow_pm tinyint(1) NOT NULL DEFAULT '1', + user_allow_email tinyint(1) NOT NULL DEFAULT '1', + user_allow_viewonline tinyint(1) NOT NULL DEFAULT '1', + user_allow_viewemail tinyint(1) NOT NULL DEFAULT '1', + user_allow_massemail tinyint(1) NOT NULL DEFAULT '1', + user_options int(11) NOT NULL DEFAULT '893', + user_avatar varchar(100) NOT NULL DEFAULT '', + user_avatar_type tinyint(2) NOT NULL DEFAULT '0', + user_avatar_width tinyint(4) NOT NULL DEFAULT '0', + user_avatar_height tinyint(4) NOT NULL DEFAULT '0', + user_sig text(65535) NOT NULL DEFAULT '', + user_sig_bbcode_uid varchar(5) NOT NULL DEFAULT '', + user_sig_bbcode_bitfield int(11) NOT NULL DEFAULT '0', + 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(100) NOT NULL DEFAULT '', + user_occ varchar(255) NOT NULL DEFAULT '', + user_interests varchar(255) NOT NULL DEFAULT '', + user_actkey varchar(32) NOT NULL DEFAULT '', + user_newpasswd varchar(32) NOT NULL DEFAULT '' +); + +CREATE INDEX user_birthday_phpbb_users on phpbb_users (user_birthday); +CREATE INDEX user_email_hash_phpbb_users on phpbb_users (user_email_hash); +CREATE INDEX username_phpbb_users on phpbb_users (username); + +# Table: phpbb_words CREATE TABLE phpbb_words ( - word_id INTEGER NOT NULL, - word CHAR(100) DEFAULT '' NOT NULL, - replacement CHAR(100) DEFAULT '' NOT NULL, - PRIMARY KEY (word_id) + word_id INTEGER PRIMARY KEY NOT NULL, + word char(100) NOT NULL, + replacement char(100) NOT NULL +); + +# Table: phpbb_zebra +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) NOT NULL DEFAULT '0', + zebra_id mediumint(8) NOT NULL DEFAULT '0', + friend tinyint(1) NOT NULL DEFAULT '0', + foe tinyint(1) NOT NULL DEFAULT '0' ); + +CREATE INDEX user_id_phpbb_zebra on phpbb_zebra (user_id); +CREATE INDEX zebra_id_phpbb_zebra on phpbb_zebra (zebra_id); + +COMMIT; |