From d757d7396d3a171bada46dbb29d65be185c221ac Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:02:51 +0100 Subject: [PATCH 1/8] [feature/tests] Add extension-testframework from phpBB gallery --- .gitignore | 3 +- .travis.yml | 41 + README.md | 4 +- composer.json | 23 + develop/create_schema_files.php | 720 +++++ develop/schema_data.php | 324 +++ ext.php | 22 + migrations/release_1_1_6.php | 566 ++++ phpunit.xml.all | 25 + phpunit.xml.dist | 32 + phpunit.xml.functional | 31 + tests/bootstrap.php | 30 + tests/mock/container_builder.php | 179 ++ tests/schemas/firebird_schema.sql | 1875 +++++++++++++ tests/schemas/mssql_schema.sql | 2231 +++++++++++++++ tests/schemas/mysql_40_schema.sql | 1336 +++++++++ tests/schemas/mysql_41_schema.sql | 1336 +++++++++ tests/schemas/oracle_schema.sql | 2420 +++++++++++++++++ tests/schemas/postgres_schema.sql | 1664 ++++++++++++ tests/schemas/sqlite_schema.sql | 1297 +++++++++ tests/systemtests/base_database_test.php | 34 + tests/systemtests/base_test.php | 18 + tests/systemtests/fixtures/basetests.xml | 31 + tests/test_config.sample.php | 7 + tests/testframework/database_test_case.php | 50 + .../database_test_connection_manager.php | 22 + tests/testframework/functional_test_case.php | 14 + tests/testframework/test_case.php | 23 + tests/testframework/test_case_helpers.php | 116 + travis/install-php-extensions.sh | 21 + travis/phpunit-mysql-travis.xml | 41 + travis/phpunit-postgres-travis.xml | 43 + travis/setup-webserver.sh | 54 + 33 files changed, 14630 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100644 composer.json create mode 100644 develop/create_schema_files.php create mode 100644 develop/schema_data.php create mode 100644 ext.php create mode 100644 migrations/release_1_1_6.php create mode 100644 phpunit.xml.all create mode 100644 phpunit.xml.dist create mode 100644 phpunit.xml.functional create mode 100644 tests/bootstrap.php create mode 100644 tests/mock/container_builder.php create mode 100644 tests/schemas/firebird_schema.sql create mode 100644 tests/schemas/mssql_schema.sql create mode 100644 tests/schemas/mysql_40_schema.sql create mode 100644 tests/schemas/mysql_41_schema.sql create mode 100644 tests/schemas/oracle_schema.sql create mode 100644 tests/schemas/postgres_schema.sql create mode 100644 tests/schemas/sqlite_schema.sql create mode 100644 tests/systemtests/base_database_test.php create mode 100644 tests/systemtests/base_test.php create mode 100644 tests/systemtests/fixtures/basetests.xml create mode 100644 tests/test_config.sample.php create mode 100644 tests/testframework/database_test_case.php create mode 100644 tests/testframework/database_test_connection_manager.php create mode 100644 tests/testframework/functional_test_case.php create mode 100644 tests/testframework/test_case.php create mode 100644 tests/testframework/test_case_helpers.php create mode 100755 travis/install-php-extensions.sh create mode 100644 travis/phpunit-mysql-travis.xml create mode 100644 travis/phpunit-postgres-travis.xml create mode 100755 travis/setup-webserver.sh diff --git a/.gitignore b/.gitignore index 61069b7a..447f872c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/.idea/* \ No newline at end of file +/.idea/* +/tests/test_config.php diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1c7c7d42 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,41 @@ +language: php +php: + - 5.3.3 + - 5.3 + - 5.4 + - 5.5 + +env: + - DB=mysql + - DB=postgres + +before_script: + # checkout phpBB and move your extension in place + - cd ../../ + - git clone "git://github.com/phpbb/phpbb3.git" "phpBB3" + - mkdir phpBB3/phpBB/ext + - mkdir phpBB3/phpBB/ext/phpbbgallery + - mv nickvergessen/phpbb3-ext-gallery phpBB3/phpBB/ext/phpbbgallery/core + + # Setup the dependencies + - cd phpBB3/phpBB + - php ../composer.phar install --dev --no-interaction --prefer-source + + # Setup the tests/travis + - cd ext/phpbbgallery/core + - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" + - travis/install-php-extensions.sh + - phpenv rehash + - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" + +script: + - ../../../vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml + +notifications: + email: + recipients: + - nickvergessen@gmx.de + on_success: change + on_failure: change diff --git a/README.md b/README.md index edf21b1b..87a7f2ab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -#Board3 Portal 2.1.0 +#Board3 Portal 2.1.x -Board Portal 2.1.0 is a second generation portal for phpBB 3.1.x. It adds a portal with several blocks to your forum. +Board Portal 2.1.x is a second generation portal for phpBB 3.1.x. It adds a portal with several blocks to your forum. You can change the settings, move the blocks, add new blocks and more in the ACP. ##How to use diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..29caa633 --- /dev/null +++ b/composer.json @@ -0,0 +1,23 @@ +{ + "name": "phpbbgallery/core", + "type": "phpbb-extension", + "description": "Experimental version of phpBB Gallery for phpBB 3.1", + "homepage": "https://github.com/nickvergessen/phpbb-ext-gallery", + "version": "0.1.0", + "time": "2013-03-27", + "licence": "GPL-2.0", + "authors": [{ + "name": "Joas Schilling", + "username": "nickvergessen", + "email": "nickvergessen@gmx.de", + "homepage": "https://github.com/nickvergessen/", + "role": "Lead Developer" + }], + "require": { + "php": ">=5.3.3", + "phpbb/phpbb": "3.1.*@dev" + }, + "extra": { + "display-name": "phpBB Gallery Core" + } +} diff --git a/develop/create_schema_files.php b/develop/create_schema_files.php new file mode 100644 index 00000000..0f736bcd --- /dev/null +++ b/develop/create_schema_files.php @@ -0,0 +1,720 @@ + $table_data) + { + // Write comment about table + switch ($dbms) + { + case 'mysql_40': + case 'mysql_41': + case 'firebird': + case 'sqlite': + fwrite($fp, "# Table: '{$table_name}'\n"); + break; + + case 'mssql': + case 'oracle': + case 'postgres': + fwrite($fp, "/*\n\tTable: '{$table_name}'\n*/\n"); + break; + } + + // Create Table statement + $generator = $textimage = false; + $line = ''; + + switch ($dbms) + { + case 'mysql_40': + case 'mysql_41': + case 'firebird': + case 'oracle': + case 'sqlite': + case 'postgres': + $line = "CREATE TABLE {$table_name} (\n"; + break; + + case 'mssql': + $line = "CREATE TABLE [{$table_name}] (\n"; + break; + } + + // Table specific so we don't get overlap + $modded_array = array(); + + // Write columns one by one... + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + if (isset($column_data[2]) && $column_data[2] == 'auto_increment' && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + if (strpos($column_data[0], ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_data[0]); + if (!is_array($dbms_type_map[$dbms][$orig_column_type . ':'])) + { + $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'], $column_length); + } + else + { + if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['rule'])) + { + switch ($dbms_type_map[$dbms][$orig_column_type . ':']['rule'][0]) + { + case 'div': + $column_length /= $dbms_type_map[$dbms][$orig_column_type . ':']['rule'][1]; + $column_length = ceil($column_length); + $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); + break; + } + } + + if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['limit'])) + { + switch ($dbms_type_map[$dbms][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + $column_length *= $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][1]; + if ($column_length > $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][2]) + { + $column_type = $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][3]; + $modded_array[$column_name] = $column_type; + } + else + { + $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); + } + break; + } + } + } + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_data[0]; + $column_type = $dbms_type_map[$dbms][$column_data[0]]; + if ($column_type == 'text' || $column_type == 'blob') + { + $modded_array[$column_name] = $column_type; + } + } + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$dbms])) ? $column_data[1][$dbms] : $column_data[1]['default']; + } + + switch ($dbms) + { + case 'mysql_40': + case 'mysql_41': + $line .= "\t{$column_name} {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') + { + $line .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + $line .= 'NOT NULL'; + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $line .= ' auto_increment'; + } + else if ($dbms === 'mysql_41' && $column_data[2] == 'true_sort') + { + $line .= ' COLLATE utf8_unicode_ci'; + } + } + + $line .= ",\n"; + break; + + case 'sqlite': + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $line .= "\t{$column_name} INTEGER PRIMARY KEY "; + $generator = $column_name; + } + else + { + $line .= "\t{$column_name} {$column_type} "; + } + + $line .= 'NOT NULL '; + $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; + $line .= ",\n"; + break; + + case 'firebird': + $line .= "\t{$column_name} {$column_type} "; + + if (!is_null($column_data[1])) + { + $line .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; + } + + $line .= 'NOT NULL'; + + // This is a UNICODE column and thus should be given it's fair share + if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) + { + $line .= ' COLLATE UNICODE'; + } + + $line .= ",\n"; + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $generator = $column_name; + } + break; + + case 'mssql': + if ($column_type == '[text]') + { + $textimage = true; + } + + $line .= "\t[{$column_name}] {$column_type} "; + + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $line .= 'DEFAULT (' . $column_data[1] . ') '; + } + else + { + $line .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + } + } + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $line .= 'IDENTITY (1, 1) '; + } + + $line .= 'NOT NULL'; + $line .= " ,\n"; + break; + + case 'oracle': + $line .= "\t{$column_name} {$column_type} "; + $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + + // In Oracle empty strings ('') are treated as NULL. + // Therefore in oracle we allow NULL's for all DEFAULT '' entries + $line .= ($column_data[1] === '') ? ",\n" : "NOT NULL,\n"; + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $generator = $column_name; + } + break; + + case 'postgres': + $line .= "\t{$column_name} {$column_type} "; + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $line .= "DEFAULT nextval('{$table_name}_seq'),\n"; + + // Make sure the sequence will be created before creating the table + $line = "CREATE SEQUENCE {$table_name}_seq;\n\n" . $line; + } + else + { + $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + $line .= "NOT NULL"; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $unsigned_types)) + { + $line .= " CHECK ({$column_name} >= 0)"; + } + + $line .= ",\n"; + } + break; + } + } + + switch ($dbms) + { + case 'firebird': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n);;\n\n"; + break; + + case 'mssql': + $line = substr($line, 0, -2); + $line .= "\n) ON [PRIMARY]" . (($textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '') . "\n"; + $line .= "GO\n\n"; + break; + } + + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + switch ($dbms) + { + case 'mysql_40': + case 'mysql_41': + case 'postgres': + $line .= "\tPRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; + break; + + case 'firebird': + $line .= "ALTER TABLE {$table_name} ADD PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ");;\n\n"; + break; + + case 'sqlite': + if ($generator === false || !in_array($generator, $table_data['PRIMARY_KEY'])) + { + $line .= "\tPRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; + } + break; + + case 'mssql': + $line .= "ALTER TABLE [{$table_name}] WITH NOCHECK ADD \n"; + $line .= "\tCONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED \n"; + $line .= "\t(\n"; + $line .= "\t\t[" . implode("],\n\t\t[", $table_data['PRIMARY_KEY']) . "]\n"; + $line .= "\t) ON [PRIMARY] \n"; + $line .= "GO\n\n"; + break; + + case 'oracle': + $line .= "\tCONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; + break; + } + } + + switch ($dbms) + { + case 'oracle': + // UNIQUE contrains to be added? + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + if ($key_data[0] == 'UNIQUE') + { + $line .= "\tCONSTRAINT u_phpbb_{$key_name} UNIQUE (" . implode(', ', $key_data[1]) . "),\n"; + } + } + } + + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n)\n/\n\n"; + break; + + case 'postgres': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n);\n\n"; + break; + + case 'sqlite': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n);\n\n"; + break; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + if (strlen($table_name . $key_name) > 30) + { + trigger_error("Index name '${table_name}_$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + switch ($dbms) + { + case 'mysql_40': + case 'mysql_41': + $line .= ($key_data[0] == 'INDEX') ? "\tKEY" : ''; + $line .= ($key_data[0] == 'UNIQUE') ? "\tUNIQUE" : ''; + foreach ($key_data[1] as $key => $col_name) + { + if (isset($modded_array[$col_name])) + { + switch ($modded_array[$col_name]) + { + case 'text': + case 'blob': + $key_data[1][$key] = $col_name . '(255)'; + break; + } + } + } + $line .= ' ' . $key_name . ' (' . implode(', ', $key_data[1]) . "),\n"; + break; + + case 'firebird': + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; + + $line .= ' ' . $table_name . '_' . $key_name . ' ON ' . $table_name . '(' . implode(', ', $key_data[1]) . ");;\n"; + break; + + case 'mssql': + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; + $line .= " [{$key_name}] ON [{$table_name}]([" . implode('], [', $key_data[1]) . "]) ON [PRIMARY]\n"; + $line .= "GO\n\n"; + break; + + case 'oracle': + if ($key_data[0] == 'UNIQUE') + { + continue; + } + + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + + $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ")\n"; + $line .= "/\n"; + break; + + case 'sqlite': + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; + + $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");\n"; + break; + + case 'postgres': + $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; + $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; + + $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");\n"; + break; + } + } + } + + switch ($dbms) + { + case 'mysql_40': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n);\n\n"; + break; + + case 'mysql_41': + // Remove last line delimiter... + $line = substr($line, 0, -2); + $line .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;\n\n"; + break; + + // Create Generator + case 'firebird': + if ($generator !== false) + { + $line .= "\nCREATE GENERATOR {$table_name}_gen;;\n"; + $line .= 'SET GENERATOR ' . $table_name . "_gen TO 0;;\n\n"; + + $line .= 'CREATE TRIGGER t_' . $table_name . ' FOR ' . $table_name . "\n"; + $line .= "BEFORE INSERT\nAS\nBEGIN\n"; + $line .= "\tNEW.{$generator} = GEN_ID({$table_name}_gen, 1);\nEND;;\n\n"; + } + break; + + case 'oracle': + if ($generator !== false) + { + $line .= "\nCREATE SEQUENCE {$table_name}_seq\n/\n\n"; + + $line .= "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; + $line .= "BEFORE INSERT ON {$table_name}\n"; + $line .= "FOR EACH ROW WHEN (\n"; + $line .= "\tnew.{$generator} IS NULL OR new.{$generator} = 0\n"; + $line .= ")\nBEGIN\n"; + $line .= "\tSELECT {$table_name}_seq.nextval\n"; + $line .= "\tINTO :new.{$generator}\n"; + $line .= "\tFROM dual;\nEND;\n/\n\n"; + } + break; + } + + fwrite($fp, $line . "\n"); + } + + $line = ''; + + // Write custom function at the end for some db's + switch ($dbms) + { + case 'mssql': + // No need to do this, no transaction support for schema changes + //$line = "\nCOMMIT\nGO\n\n"; + break; + + case 'sqlite': + $line = "\nCOMMIT;"; + break; + + case 'postgres': + $line = "\nCOMMIT;"; + break; + } + + fwrite($fp, $line); + fclose($fp); +} + +/** +* Data put into the header for various dbms +*/ +function custom_data($dbms) +{ + switch ($dbms) + { + case 'oracle': + return << LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; + +/* + Operators +*/ +CREATE OPERATOR <( + PROCEDURE = _varchar_ci_less_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR <=( + PROCEDURE = _varchar_ci_less_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR >( + PROCEDURE = _varchar_ci_greater_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR >=( + PROCEDURE = _varchar_ci_greater_equals, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR <>( + PROCEDURE = _varchar_ci_not_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = neqsel, + JOIN = neqjoinsel); + +CREATE OPERATOR =( + PROCEDURE = _varchar_ci_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel, + HASHES, + MERGES, + SORT1= <); + +EOF; + break; + } + + return ''; +} + +echo 'done'; diff --git a/develop/schema_data.php b/develop/schema_data.php new file mode 100644 index 00000000..85f03e13 --- /dev/null +++ b/develop/schema_data.php @@ -0,0 +1,324 @@ + {TABLE_DATA}) +* {TABLE_DATA}: +* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment})) +* PRIMARY_KEY = {column_name(s)} +* KEYS = array({key_name} = array({key_type}, {column_name(s)})), +* +* Column Types: +* INT:x => SIGNED int(x) +* BINT => BIGINT +* UINT => mediumint(8) UNSIGNED +* UINT:x => int(x) UNSIGNED +* TINT:x => tinyint(x) +* USINT => smallint(4) UNSIGNED (for _order columns) +* BOOL => tinyint(1) UNSIGNED +* VCHAR => varchar(255) +* CHAR:x => char(x) +* XSTEXT_UNI => text for storing 100 characters (topic_title for example) +* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI +* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.) +* MTEXT_UNI => mediumtext (post text, large text) +* VCHAR:x => varchar(x) +* TIMESTAMP => int(11) UNSIGNED +* DECIMAL => decimal number (5,2) +* DECIMAL: => decimal number (x,2) +* PDECIMAL => precision decimal number (6,3) +* PDECIMAL: => precision decimal number (x,3) +* VCHAR_UNI => varchar(255) BINARY +* VCHAR_CI => varchar_ci for postgresql, others VCHAR +*/ + +/** +* Step 1: Manipulate phpbb's tables +*/ +$schema_data['phpbb_log']['COLUMNS']['album_id'] = array('UINT', 0); +$schema_data['phpbb_log']['COLUMNS']['image_id'] = array('UINT', 0); +$schema_data['phpbb_sessions']['COLUMNS']['session_album_id'] = array('UINT', 0); +$schema_data['phpbb_sessions']['KEYS']['session_aid'] = array('INDEX', 'session_album_id'); + +/** +* Step 2: Add own tables +*/ +$schema_data['phpbb_gallery_albums'] = array( + 'COLUMNS' => array( + 'album_id' => array('UINT', NULL, 'auto_increment'), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 1), + 'right_id' => array('UINT', 2), + 'album_parents' => array('MTEXT_UNI', ''), + 'album_type' => array('UINT:3', 1), + 'album_status' => array('UINT:1', 1), + 'album_contest' => array('UINT', 0), + 'album_name' => array('VCHAR:255', ''), + 'album_desc' => array('MTEXT_UNI', ''), + 'album_desc_options' => array('UINT:3', 7), + 'album_desc_uid' => array('VCHAR:8', ''), + 'album_desc_bitfield' => array('VCHAR:255', ''), + 'album_user_id' => array('UINT', 0), + 'album_images' => array('UINT', 0), + 'album_images_real' => array('UINT', 0), + 'album_last_image_id' => array('UINT', 0), + 'album_image' => array('VCHAR', ''), + 'album_last_image_time' => array('INT:11', 0), + 'album_last_image_name' => array('VCHAR', ''), + 'album_last_username' => array('VCHAR', ''), + 'album_last_user_colour' => array('VCHAR:6', ''), + 'album_last_user_id' => array('UINT', 0), + 'album_watermark' => array('UINT:1', 1), + 'album_sort_key' => array('VCHAR:8', ''), + 'album_sort_dir' => array('VCHAR:8', ''), + 'display_in_rrc' => array('UINT:1', 1), + 'display_on_index' => array('UINT:1', 1), + 'display_subalbum_list' => array('UINT:1', 1), + 'album_feed' => array('BOOL', 1), + 'album_auth_access' => array('TINT:1', 0), + ), + 'PRIMARY_KEY' => 'album_id', +); + +$schema_data['phpbb_gallery_albums_track'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'album_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'album_id'), +); + +$schema_data['phpbb_gallery_comments'] = array( + 'COLUMNS' => array( + 'comment_id' => array('UINT', NULL, 'auto_increment'), + 'comment_image_id' => array('UINT', NULL), + 'comment_user_id' => array('UINT', 0), + 'comment_username' => array('VCHAR', ''), + 'comment_user_colour' => array('VCHAR:6', ''), + 'comment_user_ip' => array('VCHAR:40', ''), + 'comment_signature' => array('BOOL', 0), + 'comment_time' => array('UINT:11', 0), + 'comment' => array('MTEXT_UNI', ''), + 'comment_uid' => array('VCHAR:8', ''), + 'comment_bitfield' => array('VCHAR:255', ''), + 'comment_edit_time' => array('UINT:11', 0), + 'comment_edit_count' => array('USINT', 0), + 'comment_edit_user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'comment_id', + 'KEYS' => array( + 'id' => array('INDEX', 'comment_image_id'), + 'uid' => array('INDEX', 'comment_user_id'), + 'ip' => array('INDEX', 'comment_user_ip'), + 'time' => array('INDEX', 'comment_time'), + ), +); + +$schema_data['phpbb_gallery_contests'] = array( + 'COLUMNS' => array( + 'contest_id' => array('UINT', NULL, 'auto_increment'), + 'contest_album_id' => array('UINT', 0), + 'contest_start' => array('UINT:11', 0), + 'contest_rating' => array('UINT:11', 0), + 'contest_end' => array('UINT:11', 0), + 'contest_marked' => array('TINT:1', 0), + 'contest_first' => array('UINT', 0), + 'contest_second' => array('UINT', 0), + 'contest_third' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'contest_id', +); + +$schema_data['phpbb_gallery_favorites'] = array( + 'COLUMNS' => array( + 'favorite_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'image_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'favorite_id', + 'KEYS' => array( + 'uid' => array('INDEX', 'user_id'), + 'id' => array('INDEX', 'image_id'), + ), +); + +$schema_data['phpbb_gallery_images'] = array( + 'COLUMNS' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'image_filename' => array('VCHAR:255', ''), + 'image_name' => array('VCHAR:255', ''), + 'image_name_clean' => array('VCHAR:255', ''), + 'image_desc' => array('MTEXT_UNI', ''), + 'image_desc_uid' => array('VCHAR:8', ''), + 'image_desc_bitfield' => array('VCHAR:255', ''), + 'image_user_id' => array('UINT', 0), + 'image_username' => array('VCHAR:255', ''), + 'image_username_clean' => array('VCHAR:255', ''), + 'image_user_colour' => array('VCHAR:6', ''), + 'image_user_ip' => array('VCHAR:40', ''), + 'image_time' => array('UINT:11', 0), + 'image_album_id' => array('UINT', 0), + 'image_view_count' => array('UINT:11', 0), + 'image_status' => array('UINT:3', 0), + 'image_contest' => array('UINT:1', 0), + 'image_contest_end' => array('TIMESTAMP', 0), + 'image_contest_rank' => array('UINT:3', 0), + 'image_filemissing' => array('UINT:3', 0), + 'image_has_exif' => array('UINT:3', 2), + 'image_exif_data' => array('TEXT', ''), + 'image_rates' => array('UINT', 0), + 'image_rate_points' => array('UINT', 0), + 'image_rate_avg' => array('UINT', 0), + 'image_comments' => array('UINT', 0), + 'image_last_comment' => array('UINT', 0), + 'image_allow_comments' => array('TINT:1', 1), + 'image_favorited' => array('UINT', 0), + 'image_reported' => array('UINT', 0), + 'filesize_upload' => array('UINT:20', 0), + 'filesize_medium' => array('UINT:20', 0), + 'filesize_cache' => array('UINT:20', 0), + ), + 'PRIMARY_KEY' => 'image_id', + 'KEYS' => array( + 'aid' => array('INDEX', 'image_album_id'), + 'uid' => array('INDEX', 'image_user_id'), + 'time' => array('INDEX', 'image_time'), + ), +); + +$schema_data['phpbb_gallery_modscache'] = array( + 'COLUMNS' => array( + 'album_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR', ''), + 'group_id' => array('UINT', 0), + 'group_name' => array('VCHAR', ''), + 'display_on_index' => array('TINT:1', 1), + ), + 'KEYS' => array( + 'doi' => array('INDEX', 'display_on_index'), + 'aid' => array('INDEX', 'album_id'), + ), +); + +$schema_data['phpbb_gallery_permissions'] = array( + 'COLUMNS' => array( + 'perm_id' => array('UINT', NULL, 'auto_increment'), + 'perm_role_id' => array('UINT', 0), + 'perm_album_id' => array('UINT', 0), + 'perm_user_id' => array('UINT', 0), + 'perm_group_id' => array('UINT', 0), + 'perm_system' => array('INT:3', 0), + ), + 'PRIMARY_KEY' => 'perm_id', +); + +$schema_data['phpbb_gallery_rates'] = array( + 'COLUMNS' => array( + 'rate_image_id' => array('UINT', 0), + 'rate_user_id' => array('UINT', 0), + 'rate_user_ip' => array('VCHAR:40', ''), + 'rate_point' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => array('rate_image_id', 'rate_user_id'), +); + +$schema_data['phpbb_gallery_reports'] = array( + 'COLUMNS' => array( + 'report_id' => array('UINT', NULL, 'auto_increment'), + 'report_album_id' => array('UINT', 0), + 'report_image_id' => array('UINT', 0), + 'reporter_id' => array('UINT', 0), + 'report_manager' => array('UINT', 0), + 'report_note' => array('MTEXT_UNI', ''), + 'report_time' => array('UINT:11', 0), + 'report_status' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => 'report_id', +); + +$schema_data['phpbb_gallery_roles'] = array( + 'COLUMNS' => array( + 'role_id' => array('UINT', NULL, 'auto_increment'), + 'a_list' => array('UINT:3', 0), + 'i_view' => array('UINT:3', 0), + 'i_watermark' => array('UINT:3', 0), + 'i_upload' => array('UINT:3', 0), + 'i_edit' => array('UINT:3', 0), + 'i_delete' => array('UINT:3', 0), + 'i_rate' => array('UINT:3', 0), + 'i_approve' => array('UINT:3', 0), + 'i_lock' => array('UINT:3', 0), + 'i_report' => array('UINT:3', 0), + 'i_count' => array('UINT', 0), + 'i_unlimited' => array('UINT:3', 0), + 'c_read' => array('UINT:3', 0), + 'c_post' => array('UINT:3', 0), + 'c_edit' => array('UINT:3', 0), + 'c_delete' => array('UINT:3', 0), + 'm_comments' => array('UINT:3', 0), + 'm_delete' => array('UINT:3', 0), + 'm_edit' => array('UINT:3', 0), + 'm_move' => array('UINT:3', 0), + 'm_report' => array('UINT:3', 0), + 'm_status' => array('UINT:3', 0), + 'a_count' => array('UINT', 0), + 'a_unlimited' => array('UINT:3', 0), + 'a_restrict' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => 'role_id', +); + +$schema_data['phpbb_gallery_users'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'watch_own' => array('UINT:3', 0), + 'watch_favo' => array('UINT:3', 0), + 'watch_com' => array('UINT:3', 0), + 'user_images' => array('UINT', 0), + 'personal_album_id' => array('UINT', 0), + 'user_lastmark' => array('TIMESTAMP', 0), + 'user_last_update' => array('TIMESTAMP', 0), + 'user_viewexif' => array('UINT:1', 0), + 'user_permissions' => array('MTEXT_UNI', ''), + 'user_permissions_changed' => array('TIMESTAMP', 0), + 'user_allow_comments' => array('TINT:1', 1), + 'subscribe_pegas' => array('TINT:1', 0), + ), + 'PRIMARY_KEY' => 'user_id', + 'KEYS' => array( + 'pega' => array('INDEX', array('personal_album_id')), + ), +); + +$schema_data['phpbb_gallery_watch'] = array( + 'COLUMNS' => array( + 'watch_id' => array('UINT', NULL, 'auto_increment'), + 'album_id' => array('UINT', 0), + 'image_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'watch_id', + 'KEYS' => array( + 'uid' => array('INDEX', 'user_id'), + 'id' => array('INDEX', 'image_id'), + 'aid' => array('INDEX', 'album_id'), + ), +); diff --git a/ext.php b/ext.php new file mode 100644 index 00000000..b5a79156 --- /dev/null +++ b/ext.php @@ -0,0 +1,22 @@ +table_prefix . "config + WHERE config_name = 'phpbb_gallery_version'"; + $result = $this->db->sql_query($sql); + $version = $this->db->sql_fetchfield('config_value'); + $this->db->sql_freeresult($result); + + return $version && (version_compare($version, '1.1.6') >= 0); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'gallery_albums' => array( + 'COLUMNS' => array( + 'album_id' => array('UINT', NULL, 'auto_increment'), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 1), + 'right_id' => array('UINT', 2), + 'album_parents' => array('MTEXT_UNI', ''), + 'album_type' => array('UINT:3', 1), + 'album_status' => array('UINT:1', 1), + 'album_contest' => array('UINT', 0), + 'album_name' => array('VCHAR:255', ''), + 'album_desc' => array('MTEXT_UNI', ''), + 'album_desc_options' => array('UINT:3', 7), + 'album_desc_uid' => array('VCHAR:8', ''), + 'album_desc_bitfield' => array('VCHAR:255', ''), + 'album_user_id' => array('UINT', 0), + 'album_images' => array('UINT', 0), + 'album_images_real' => array('UINT', 0), + 'album_last_image_id' => array('UINT', 0), + 'album_image' => array('VCHAR', ''), + 'album_last_image_time' => array('INT:11', 0), + 'album_last_image_name' => array('VCHAR', ''), + 'album_last_username' => array('VCHAR', ''), + 'album_last_user_colour' => array('VCHAR:6', ''), + 'album_last_user_id' => array('UINT', 0), + 'album_watermark' => array('UINT:1', 1), + 'album_sort_key' => array('VCHAR:8', ''), + 'album_sort_dir' => array('VCHAR:8', ''), + 'display_in_rrc' => array('UINT:1', 1), + 'display_on_index' => array('UINT:1', 1), + 'display_subalbum_list' => array('UINT:1', 1), + 'album_auth_access' => array('TINT:1', 0), + ), + 'PRIMARY_KEY' => 'album_id', + ), + $this->table_prefix . 'gallery_albums_track' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'album_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'album_id'), + ), + $this->table_prefix . 'gallery_comments' => array( + 'COLUMNS' => array( + 'comment_id' => array('UINT', NULL, 'auto_increment'), + 'comment_image_id' => array('UINT', NULL), + 'comment_user_id' => array('UINT', 0), + 'comment_username' => array('VCHAR', ''), + 'comment_user_colour' => array('VCHAR:6', ''), + 'comment_user_ip' => array('VCHAR:40', ''), + 'comment_signature' => array('BOOL', 0), + 'comment_time' => array('UINT:11', 0), + 'comment' => array('MTEXT_UNI', ''), + 'comment_uid' => array('VCHAR:8', ''), + 'comment_bitfield' => array('VCHAR:255', ''), + 'comment_edit_time' => array('UINT:11', 0), + 'comment_edit_count' => array('USINT', 0), + 'comment_edit_user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'comment_id', + 'KEYS' => array( + 'id' => array('INDEX', 'comment_image_id'), + 'uid' => array('INDEX', 'comment_user_id'), + 'ip' => array('INDEX', 'comment_user_ip'), + 'time' => array('INDEX', 'comment_time'), + ), + ), + $this->table_prefix . 'gallery_contests' => array( + 'COLUMNS' => array( + 'contest_id' => array('UINT', NULL, 'auto_increment'), + 'contest_album_id' => array('UINT', 0), + 'contest_start' => array('UINT:11', 0), + 'contest_rating' => array('UINT:11', 0), + 'contest_end' => array('UINT:11', 0), + 'contest_marked' => array('TINT:1', 0), + 'contest_first' => array('UINT', 0), + 'contest_second' => array('UINT', 0), + 'contest_third' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'contest_id', + ), + $this->table_prefix . 'gallery_favorites' => array( + 'COLUMNS' => array( + 'favorite_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'image_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'favorite_id', + 'KEYS' => array( + 'uid' => array('INDEX', 'user_id'), + 'id' => array('INDEX', 'image_id'), + ), + ), + $this->table_prefix . 'gallery_images' => array( + 'COLUMNS' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'image_filename' => array('VCHAR:255', ''), + 'image_name' => array('VCHAR:255', ''), + 'image_name_clean' => array('VCHAR:255', ''), + 'image_desc' => array('MTEXT_UNI', ''), + 'image_desc_uid' => array('VCHAR:8', ''), + 'image_desc_bitfield' => array('VCHAR:255', ''), + 'image_user_id' => array('UINT', 0), + 'image_username' => array('VCHAR:255', ''), + 'image_username_clean' => array('VCHAR:255', ''), + 'image_user_colour' => array('VCHAR:6', ''), + 'image_user_ip' => array('VCHAR:40', ''), + 'image_time' => array('UINT:11', 0), + 'image_album_id' => array('UINT', 0), + 'image_view_count' => array('UINT:11', 0), + 'image_status' => array('UINT:3', 0), + 'image_contest' => array('UINT:1', 0), + 'image_contest_end' => array('TIMESTAMP', 0), + 'image_contest_rank' => array('UINT:3', 0), + 'image_filemissing' => array('UINT:3', 0), + 'image_rates' => array('UINT', 0), + 'image_rate_points' => array('UINT', 0), + 'image_rate_avg' => array('UINT', 0), + 'image_comments' => array('UINT', 0), + 'image_last_comment' => array('UINT', 0), + 'image_allow_comments' => array('TINT:1', 1), + 'image_favorited' => array('UINT', 0), + 'image_reported' => array('UINT', 0), + 'filesize_upload' => array('UINT:20', 0), + 'filesize_medium' => array('UINT:20', 0), + 'filesize_cache' => array('UINT:20', 0), + ), + 'PRIMARY_KEY' => 'image_id', + 'KEYS' => array( + 'aid' => array('INDEX', 'image_album_id'), + 'uid' => array('INDEX', 'image_user_id'), + 'time' => array('INDEX', 'image_time'), + ), + ), + $this->table_prefix . 'gallery_modscache' => array( + 'COLUMNS' => array( + 'album_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR', ''), + 'group_id' => array('UINT', 0), + 'group_name' => array('VCHAR', ''), + 'display_on_index' => array('TINT:1', 1), + ), + 'KEYS' => array( + 'doi' => array('INDEX', 'display_on_index'), + 'aid' => array('INDEX', 'album_id'), + ), + ), + $this->table_prefix . 'gallery_permissions' => array( + 'COLUMNS' => array( + 'perm_id' => array('UINT', NULL, 'auto_increment'), + 'perm_role_id' => array('UINT', 0), + 'perm_album_id' => array('UINT', 0), + 'perm_user_id' => array('UINT', 0), + 'perm_group_id' => array('UINT', 0), + 'perm_system' => array('INT:3', 0), + ), + 'PRIMARY_KEY' => 'perm_id', + ), + $this->table_prefix . 'gallery_rates' => array( + 'COLUMNS' => array( + 'rate_image_id' => array('UINT', 0), + 'rate_user_id' => array('UINT', 0), + 'rate_user_ip' => array('VCHAR:40', ''), + 'rate_point' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => array('rate_image_id', 'rate_user_id'), + ), + $this->table_prefix . 'gallery_reports' => array( + 'COLUMNS' => array( + 'report_id' => array('UINT', NULL, 'auto_increment'), + 'report_album_id' => array('UINT', 0), + 'report_image_id' => array('UINT', 0), + 'reporter_id' => array('UINT', 0), + 'report_manager' => array('UINT', 0), + 'report_note' => array('MTEXT_UNI', ''), + 'report_time' => array('UINT:11', 0), + 'report_status' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => 'report_id', + ), + $this->table_prefix . 'gallery_roles' => array( + 'COLUMNS' => array( + 'role_id' => array('UINT', NULL, 'auto_increment'), + 'a_list' => array('UINT:3', 0), + 'i_view' => array('UINT:3', 0), + 'i_watermark' => array('UINT:3', 0), + 'i_upload' => array('UINT:3', 0), + 'i_edit' => array('UINT:3', 0), + 'i_delete' => array('UINT:3', 0), + 'i_rate' => array('UINT:3', 0), + 'i_approve' => array('UINT:3', 0), + 'i_lock' => array('UINT:3', 0), + 'i_report' => array('UINT:3', 0), + 'i_count' => array('UINT', 0), + 'i_unlimited' => array('UINT:3', 0), + 'c_read' => array('UINT:3', 0), + 'c_post' => array('UINT:3', 0), + 'c_edit' => array('UINT:3', 0), + 'c_delete' => array('UINT:3', 0), + 'm_comments' => array('UINT:3', 0), + 'm_delete' => array('UINT:3', 0), + 'm_edit' => array('UINT:3', 0), + 'm_move' => array('UINT:3', 0), + 'm_report' => array('UINT:3', 0), + 'm_status' => array('UINT:3', 0), + 'a_count' => array('UINT', 0), + 'a_unlimited' => array('UINT:3', 0), + 'a_restrict' => array('UINT:3', 0), + ), + 'PRIMARY_KEY' => 'role_id', + ), + $this->table_prefix . 'gallery_users' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'watch_own' => array('UINT:3', 0), + 'watch_favo' => array('UINT:3', 0), + 'watch_com' => array('UINT:3', 0), + 'user_images' => array('UINT', 0), + 'personal_album_id' => array('UINT', 0), + 'user_lastmark' => array('TIMESTAMP', 0), + 'user_last_update' => array('TIMESTAMP', 0), + 'user_permissions' => array('MTEXT_UNI', ''), + 'user_permissions_changed' => array('TIMESTAMP', 0), + 'user_allow_comments' => array('TINT:1', 1), + 'subscribe_pegas' => array('TINT:1', 0), + ), + 'PRIMARY_KEY' => 'user_id', + 'KEYS' => array( + 'pega' => array('INDEX', array('personal_album_id')), + ), + ), + $this->table_prefix . 'gallery_watch' => array( + 'COLUMNS' => array( + 'watch_id' => array('UINT', NULL, 'auto_increment'), + 'album_id' => array('UINT', 0), + 'image_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'watch_id', + 'KEYS' => array( + 'uid' => array('INDEX', 'user_id'), + 'id' => array('INDEX', 'image_id'), + 'aid' => array('INDEX', 'album_id'), + ), + ), + ), + 'add_columns' => array( + $this->table_prefix . 'log' => array( + 'album_id' => array('UINT', 0), + 'image_id' => array('UINT', 0), + ), + $this->table_prefix . 'sessions' => array( + 'session_album_id' => array('UINT', 0), + ), + ), + 'add_index' => array( + $this->table_prefix . 'sessions' => array( + 'session_aid' => array('session_album_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'sessions' => array( + 'session_aid', + ), + ), + 'drop_columns' => array( + $this->table_prefix . 'log' => array( + 'album_id', + 'image_id', + ), + $this->table_prefix . 'sessions' => array( + 'session_album_id', + ), + ), + 'drop_tables' => array( + $this->table_prefix . 'gallery_albums', + $this->table_prefix . 'gallery_albums_track', + $this->table_prefix . 'gallery_comments', + $this->table_prefix . 'gallery_contests', + $this->table_prefix . 'gallery_favorites', + $this->table_prefix . 'gallery_images', + $this->table_prefix . 'gallery_modscache', + $this->table_prefix . 'gallery_permissions', + $this->table_prefix . 'gallery_rates', + $this->table_prefix . 'gallery_reports', + $this->table_prefix . 'gallery_roles', + $this->table_prefix . 'gallery_users', + $this->table_prefix . 'gallery_watch', + ), + ); + } + + public function update_data() + { + return array( + array('permission.add', array('a_gallery_manage', true, 'a_board')), + array('permission.add', array('a_gallery_albums', true, 'a_board')), + array('permission.add', array('a_gallery_import', true, 'a_board')), + array('permission.add', array('a_gallery_cleanup', true, 'a_board')), + + // ACP + array('module.add', array('acp', 'ACP_CAT_DOT_MODS', 'PHPBB_GALLERY')), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\main_module', + 'module_langname' => 'ACP_GALLERY_OVERVIEW', + 'module_mode' => 'overview', + 'module_auth' => 'acl_a_gallery_manage', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\config_module', + 'module_langname' => 'ACP_GALLERY_CONFIGURE_GALLERY', + 'module_mode' => 'main', + 'module_auth' => 'acl_a_gallery_manage', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\albums_module', + 'module_langname' => 'ACP_GALLERY_MANAGE_ALBUMS', + 'module_mode' => 'manage', + 'module_auth' => 'acl_a_gallery_albums', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\permissions_module', + 'module_langname' => 'ACP_GALLERY_ALBUM_PERMISSIONS', + 'module_mode' => 'manage', + 'module_auth' => 'acl_a_gallery_albums', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\permissions_module', + 'module_langname' => 'ACP_GALLERY_ALBUM_PERMISSIONS_COPY', + 'module_mode' => 'copy', + 'module_auth' => 'acl_a_gallery_albums', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\gallery_module', + 'module_langname' => 'ACP_IMPORT_ALBUMS', + 'module_mode' => 'import_images', + 'module_auth' => 'acl_a_gallery_import', + ))), + array('module.add', array('acp', 'PHPBB_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\acp\gallery_module', + 'module_langname' => 'ACP_GALLERY_CLEANUP', + 'module_mode' => 'cleanup', + 'module_auth' => 'acl_a_gallery_cleanup', + ))), + + // UCP + array('module.add', array('ucp', '', 'UCP_GALLERY')), + array('module.add', array('ucp', 'UCP_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\ucp\gallery_module', + 'module_langname' => 'UCP_GALLERY_SETTINGS', + 'module_mode' => 'manage_settings', + 'module_auth' => '', + ))), + array('module.add', array('ucp', 'UCP_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\ucp\gallery_module', + 'module_langname' => 'UCP_GALLERY_PERSONAL_ALBUMS', + 'module_mode' => 'manage_albums', + 'module_auth' => '', + ))), + array('module.add', array('ucp', 'UCP_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\ucp\gallery_module', + 'module_langname' => 'UCP_GALLERY_WATCH', + 'module_mode' => 'manage_subscriptions', + 'module_auth' => '', + ))), + array('module.add', array('ucp', 'UCP_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\ucp\gallery_module', + 'module_langname' => 'UCP_GALLERY_FAVORITES', + 'module_mode' => 'manage_favorites', + 'module_auth' => '', + ))), + + // Logs + array('module.add', array('acp', 'ACP_FORUM_LOGS', array( + 'module_basename' => 'logs', + 'module_langname' => 'ACP_GALLERY_LOGS', + 'module_mode' => 'gallery', + 'module_auth' => 'acl_a_viewlogs', + ))), + + // @todo: ADD BBCODE + array('custom', array(array(&$this, 'install_config'))), + ); + } + + public function install_config() + { + global $config; + + foreach (self::$configs as $name => $value) + { + if (isset(self::$is_dynamic[$name])) + { + $config->set('phpbb_gallery_' . $name, $value, true); + } + else + { + $config->set('phpbb_gallery_' . $name, $value); + } + } + + return true; + } + + static public $is_dynamic = array( + 'mvc_time', + 'mvc_version', + + 'num_comments', + 'num_images', + 'num_pegas', + + 'current_upload_dir_size', + ); + + static public $configs = array( + 'album_columns' => 3, + 'album_display' => 254, + 'album_images' => 2500, + 'album_rows' => 4, + 'allow_comments' => true, + 'allow_gif' => true, + 'allow_hotlinking' => true, + 'allow_jpg' => true, + 'allow_png' => true, + 'allow_rates' => true, + 'allow_resize' => true, + 'allow_rotate' => true, + 'allow_zip' => false, + + 'captcha_comment' => true, + 'captcha_upload' => true, + 'comment_length' => 2000, + 'comment_user_control' => true, + 'contests_ended' => 0, + 'current_upload_dir_size' => 0, + 'current_upload_dir' => 0, + + 'default_sort_dir' => 'd', + 'default_sort_key' => 't', + 'description_length'=> 2000, + 'disp_birthdays' => false, + 'disp_image_url' => true, + 'disp_login' => true, + 'disp_nextprev_thumbnail' => false, + 'disp_statistic' => true, + 'disp_total_images' => true, + 'disp_whoisonline' => true, + + 'gdlib_version' => 2, + + 'hotlinking_domains' => 'flying-bits.org', + + 'jpg_quality' => 100, + + 'link_thumbnail' => 'image_page', + 'link_imagepage' => 'image', + 'link_image_name' => 'image_page', + 'link_image_icon' => 'image_page', + + 'max_filesize' => 512000, + 'max_height' => 1024, + 'max_rating' => 10, + 'max_width' => 1280, + 'medium_cache' => true, + 'medium_height' => 600, + 'medium_width' => 800, + 'mini_thumbnail_disp' => true, + 'mini_thumbnail_size' => 70, + 'mvc_ignore' => 0, + 'mvc_time' => 0, + 'mvc_version' => '', + + 'newest_pega_user_id' => 0, + 'newest_pega_username' => '', + 'newest_pega_user_colour' => '', + 'newest_pega_album_id' => 0, + 'num_comments' => 0, + 'num_images' => 0, + 'num_pegas' => 0, + 'num_uploads' => 10, + + 'pegas_index_album' => false, + 'pegas_per_page' => 15, + 'profile_user_images' => true, + 'profile_pega' => true, + 'prune_orphan_time' => 0, + + 'rrc_gindex_columns' => 4, + 'rrc_gindex_comments' => false, + 'rrc_gindex_contests' => 1, + 'rrc_gindex_crows' => 5, + 'rrc_gindex_display' => 173, + 'rrc_gindex_mode' => 7, + 'rrc_gindex_pegas' => true, + 'rrc_gindex_rows' => 1, + 'rrc_profile_columns' => 4, + 'rrc_profile_display' => 141, + 'rrc_profile_mode' => 3, + 'rrc_profile_pegas' => true, + 'rrc_profile_rows' => 1, + + 'search_display' => 45, + 'shortnames' => 25, + + 'thumbnail_cache' => true, + 'thumbnail_height' => 160, + 'thumbnail_infoline' => false, + 'thumbnail_quality' => 50, + 'thumbnail_width' => 240, + + 'version' => '', + 'viewtopic_icon' => true, + 'viewtopic_images' => true, + 'viewtopic_link' => false, + + 'watermark_changed' => 0, + 'watermark_enabled' => true, + 'watermark_height' => 50, + 'watermark_position' => 20, + 'watermark_source' => 'gallery/images/watermark.png', + 'watermark_width' => 200, + ); +} diff --git a/phpunit.xml.all b/phpunit.xml.all new file mode 100644 index 00000000..3fd2cf33 --- /dev/null +++ b/phpunit.xml.all @@ -0,0 +1,25 @@ + + + + + + ./tests/ + + + + + + ./tests/ + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..0cbd04ff --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + ./tests/ + + + + + + functional + slow + + + + + + ./tests/ + + + diff --git a/phpunit.xml.functional b/phpunit.xml.functional new file mode 100644 index 00000000..8f22ba20 --- /dev/null +++ b/phpunit.xml.functional @@ -0,0 +1,31 @@ + + + + + + ./tests/ + + + + + + functional + + + + + + ./tests/ + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000..497654eb --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,30 @@ +register(); +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', $phpbb_root_path . 'ext/', "php"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php"); +$phpbb_class_loader->register(); + +require_once $phpbb_root_path . '../tests/test_framework/phpbb_test_case_helpers.' . $phpEx; +require_once $phpbb_root_path . '../tests/test_framework/phpbb_test_case.' . $phpEx; +require_once $phpbb_root_path . '../tests/test_framework/phpbb_database_test_case.' . $phpEx; +require_once $phpbb_root_path . '../tests/test_framework/phpbb_database_test_connection_manager.' . $phpEx; +require_once $phpbb_root_path . '../tests/test_framework/phpbb_functional_test_case.' . $phpEx; diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php new file mode 100644 index 00000000..734d3e17 --- /dev/null +++ b/tests/mock/container_builder.php @@ -0,0 +1,179 @@ +services[$id] = $service; + } + + /** + * Gets a service. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * + * @return object The associated service + * + * @throws InvalidArgumentException if the service is not defined + * @throws ServiceCircularReferenceException When a circular reference is detected + * @throws ServiceNotFoundException When the service is not defined + * + * @see Reference + * + * @api + */ + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) + { + if ($this->has($id)) + { + return $this->services[$id]; + } + + throw new Exception('Could not find service: ' . $id); + } + + /** + * Returns true if the given service is defined. + * + * @param string $id The service identifier + * + * @return Boolean true if the service is defined, false otherwise + * + * @api + */ + public function has($id) + { + return isset($this->services[$id]); + } + + /** + * Gets a parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws InvalidArgumentException if the parameter is not defined + * + * @api + */ + public function getParameter($name) + { + if ($this->hasParameter($name)) + { + return $this->parameters[$name]; + } + + throw new Exception('Could not find parameter: ' . $name); + } + + /** + * Checks if a parameter exists. + * + * @param string $name The parameter name + * + * @return Boolean The presence of parameter in container + * + * @api + */ + public function hasParameter($name) + { + return isset($this->parameters[$name]); + } + + /** + * Sets a parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function setParameter($name, $value) + { + $this->parameters[$name] = $value; + } + + /** + * Enters the given scope + * + * @param string $name + * + * @api + */ + public function enterScope($name) + { + } + + /** + * Leaves the current scope, and re-enters the parent scope + * + * @param string $name + * + * @api + */ + public function leaveScope($name) + { + } + + /** + * Adds a scope to the container + * + * @param ScopeInterface $scope + * + * @api + */ + public function addScope(ScopeInterface $scope) + { + } + + /** + * Whether this container has the given scope + * + * @param string $name + * + * @return Boolean + * + * @api + */ + public function hasScope($name) + { + } + + /** + * Determines whether the given scope is currently active. + * + * It does however not check if the scope actually exists. + * + * @param string $name + * + * @return Boolean + * + * @api + */ + public function isScopeActive($name) + { + } +} diff --git a/tests/schemas/firebird_schema.sql b/tests/schemas/firebird_schema.sql new file mode 100644 index 00000000..444dd730 --- /dev/null +++ b/tests/schemas/firebird_schema.sql @@ -0,0 +1,1875 @@ +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. + +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id INTEGER NOT NULL, + post_msg_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + in_message INTEGER DEFAULT 0 NOT NULL, + poster_id INTEGER DEFAULT 0 NOT NULL, + is_orphan INTEGER DEFAULT 1 NOT NULL, + physical_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + real_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + download_count INTEGER DEFAULT 0 NOT NULL, + attach_comment BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + mimetype VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + filesize INTEGER DEFAULT 0 NOT NULL, + filetime INTEGER DEFAULT 0 NOT NULL, + thumbnail INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_attachments ADD PRIMARY KEY (attach_id);; + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments(filetime);; +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments(post_msg_id);; +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments(topic_id);; +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments(poster_id);; +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments(is_orphan);; + +CREATE GENERATOR phpbb_attachments_gen;; +SET GENERATOR phpbb_attachments_gen TO 0;; + +CREATE TRIGGER t_phpbb_attachments FOR phpbb_attachments +BEFORE INSERT +AS +BEGIN + NEW.attach_id = GEN_ID(phpbb_attachments_gen, 1); +END;; + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_role_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups(group_id);; +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups(auth_option_id);; +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups(auth_role_id);; + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id INTEGER NOT NULL, + auth_option VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, + is_global INTEGER DEFAULT 0 NOT NULL, + is_local INTEGER DEFAULT 0 NOT NULL, + founder_only INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_options ADD PRIMARY KEY (auth_option_id);; + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; + +CREATE GENERATOR phpbb_acl_options_gen;; +SET GENERATOR phpbb_acl_options_gen TO 0;; + +CREATE TRIGGER t_phpbb_acl_options FOR phpbb_acl_options +BEFORE INSERT +AS +BEGIN + NEW.auth_option_id = GEN_ID(phpbb_acl_options_gen, 1); +END;; + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id INTEGER NOT NULL, + role_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + role_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + role_type VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + role_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_roles ADD PRIMARY KEY (role_id);; + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles(role_type);; +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles(role_order);; + +CREATE GENERATOR phpbb_acl_roles_gen;; +SET GENERATOR phpbb_acl_roles_gen TO 0;; + +CREATE TRIGGER t_phpbb_acl_roles FOR phpbb_acl_roles +BEFORE INSERT +AS +BEGIN + NEW.role_id = GEN_ID(phpbb_acl_roles_gen, 1); +END;; + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_roles_data ADD PRIMARY KEY (role_id, auth_option_id);; + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data(auth_option_id);; + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_role_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);; +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);; +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);; + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id INTEGER NOT NULL, + ban_userid INTEGER DEFAULT 0 NOT NULL, + ban_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + ban_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + 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) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + ban_give_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_banlist ADD PRIMARY KEY (ban_id);; + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist(ban_end);; +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist(ban_userid, ban_exclude);; +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist(ban_email, ban_exclude);; +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist(ban_ip, ban_exclude);; + +CREATE GENERATOR phpbb_banlist_gen;; +SET GENERATOR phpbb_banlist_gen TO 0;; + +CREATE TRIGGER t_phpbb_banlist FOR phpbb_banlist +BEFORE INSERT +AS +BEGIN + NEW.ban_id = GEN_ID(phpbb_banlist_gen, 1); +END;; + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id INTEGER DEFAULT 0 NOT NULL, + bbcode_tag VARCHAR(16) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_helpline VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + display_on_posting INTEGER DEFAULT 0 NOT NULL, + bbcode_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + bbcode_tpl BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + first_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + first_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + second_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + second_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_bbcodes ADD PRIMARY KEY (bbcode_id);; + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes(display_on_posting);; + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_bookmarks ADD PRIMARY KEY (topic_id, user_id);; + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id INTEGER NOT NULL, + bot_active INTEGER DEFAULT 1 NOT NULL, + bot_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_id INTEGER DEFAULT 0 NOT NULL, + bot_agent VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bot_ip VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_bots ADD PRIMARY KEY (bot_id);; + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots(bot_active);; + +CREATE GENERATOR phpbb_bots_gen;; +SET GENERATOR phpbb_bots_gen TO 0;; + +CREATE TRIGGER t_phpbb_bots FOR phpbb_bots +BEFORE INSERT +AS +BEGIN + NEW.bot_id = GEN_ID(phpbb_bots_gen, 1); +END;; + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + config_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + is_dynamic INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_config ADD PRIMARY KEY (config_name);; + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config(is_dynamic);; + +# Table: 'phpbb_config_text' +CREATE TABLE phpbb_config_text ( + config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + config_value BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_config_text ADD PRIMARY KEY (config_name);; + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + confirm_type INTEGER DEFAULT 0 NOT NULL, + code VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + seed INTEGER DEFAULT 0 NOT NULL, + attempts INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_confirm ADD PRIMARY KEY (session_id, confirm_id);; + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm(confirm_type);; + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id INTEGER NOT NULL, + disallow_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_disallow ADD PRIMARY KEY (disallow_id);; + + +CREATE GENERATOR phpbb_disallow_gen;; +SET GENERATOR phpbb_disallow_gen TO 0;; + +CREATE TRIGGER t_phpbb_disallow FOR phpbb_disallow +BEFORE INSERT +AS +BEGIN + NEW.disallow_id = GEN_ID(phpbb_disallow_gen, 1); +END;; + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + save_time INTEGER DEFAULT 0 NOT NULL, + draft_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + draft_message BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_drafts ADD PRIMARY KEY (draft_id);; + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts(save_time);; + +CREATE GENERATOR phpbb_drafts_gen;; +SET GENERATOR phpbb_drafts_gen TO 0;; + +CREATE TRIGGER t_phpbb_drafts FOR phpbb_drafts +BEFORE INSERT +AS +BEGIN + NEW.draft_id = GEN_ID(phpbb_drafts_gen, 1); +END;; + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + ext_active INTEGER DEFAULT 0 NOT NULL, + ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id INTEGER NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL, + extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_extensions ADD PRIMARY KEY (extension_id);; + + +CREATE GENERATOR phpbb_extensions_gen;; +SET GENERATOR phpbb_extensions_gen TO 0;; + +CREATE TRIGGER t_phpbb_extensions FOR phpbb_extensions +BEFORE INSERT +AS +BEGIN + NEW.extension_id = GEN_ID(phpbb_extensions_gen, 1); +END;; + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id INTEGER NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + cat_id INTEGER DEFAULT 0 NOT NULL, + allow_group INTEGER DEFAULT 0 NOT NULL, + download_mode INTEGER DEFAULT 1 NOT NULL, + upload_icon VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + max_filesize INTEGER DEFAULT 0 NOT NULL, + allowed_forums BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + allow_in_pm INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_extension_groups ADD PRIMARY KEY (group_id);; + + +CREATE GENERATOR phpbb_extension_groups_gen;; +SET GENERATOR phpbb_extension_groups_gen TO 0;; + +CREATE TRIGGER t_phpbb_extension_groups FOR phpbb_extension_groups +BEFORE INSERT +AS +BEGIN + NEW.group_id = GEN_ID(phpbb_extension_groups_gen, 1); +END;; + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id INTEGER NOT NULL, + parent_id INTEGER DEFAULT 0 NOT NULL, + left_id INTEGER DEFAULT 0 NOT NULL, + right_id INTEGER DEFAULT 0 NOT NULL, + forum_parents BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + forum_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_desc_options INTEGER DEFAULT 7 NOT NULL, + forum_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_style INTEGER DEFAULT 0 NOT NULL, + forum_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_rules BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + forum_rules_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_rules_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_rules_options INTEGER DEFAULT 7 NOT NULL, + forum_rules_uid VARCHAR(8) CHARACTER SET NONE 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_approved INTEGER DEFAULT 0 NOT NULL, + forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL, + forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, + forum_topics_approved INTEGER DEFAULT 0 NOT NULL, + forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL, + forum_topics_softdeleted 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_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_last_post_time INTEGER DEFAULT 0 NOT NULL, + forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_flags INTEGER DEFAULT 32 NOT NULL, + forum_options INTEGER DEFAULT 0 NOT NULL, + display_subforum_list INTEGER DEFAULT 1 NOT NULL, + display_on_index INTEGER DEFAULT 1 NOT NULL, + enable_indexing 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_viewed INTEGER DEFAULT 0 NOT NULL, + prune_freq INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_forums ADD PRIMARY KEY (forum_id);; + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums(left_id, right_id);; +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums(forum_last_post_id);; + +CREATE GENERATOR phpbb_forums_gen;; +SET GENERATOR phpbb_forums_gen TO 0;; + +CREATE TRIGGER t_phpbb_forums FOR phpbb_forums +BEFORE INSERT +AS +BEGIN + NEW.forum_id = GEN_ID(phpbb_forums_gen, 1); +END;; + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_forums_access ADD PRIMARY KEY (forum_id, user_id, session_id);; + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + mark_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_forums_track ADD PRIMARY KEY (user_id, forum_id);; + + +# 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 +);; + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch(forum_id);; +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch(user_id);; +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch(notify_status);; + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id INTEGER NOT NULL, + group_type INTEGER DEFAULT 1 NOT NULL, + group_founder_manage INTEGER DEFAULT 0 NOT NULL, + group_skip_auth INTEGER DEFAULT 0 NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_desc_options INTEGER DEFAULT 7 NOT NULL, + group_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_display INTEGER DEFAULT 0 NOT NULL, + group_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_avatar_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_avatar_width INTEGER DEFAULT 0 NOT NULL, + group_avatar_height INTEGER DEFAULT 0 NOT NULL, + group_rank INTEGER DEFAULT 0 NOT NULL, + group_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_sig_chars INTEGER DEFAULT 0 NOT NULL, + group_receive_pm INTEGER DEFAULT 0 NOT NULL, + group_message_limit INTEGER DEFAULT 0 NOT NULL, + group_max_recipients INTEGER DEFAULT 0 NOT NULL, + group_legend INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups(group_legend, group_name);; + +CREATE GENERATOR phpbb_groups_gen;; +SET GENERATOR phpbb_groups_gen TO 0;; + +CREATE TRIGGER t_phpbb_groups FOR phpbb_groups +BEFORE INSERT +AS +BEGIN + NEW.group_id = GEN_ID(phpbb_groups_gen, 1); +END;; + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id INTEGER NOT NULL, + icons_url VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + icons_width INTEGER DEFAULT 0 NOT NULL, + icons_height INTEGER DEFAULT 0 NOT NULL, + icons_order INTEGER DEFAULT 0 NOT NULL, + display_on_posting INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_icons ADD PRIMARY KEY (icons_id);; + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons(display_on_posting);; + +CREATE GENERATOR phpbb_icons_gen;; +SET GENERATOR phpbb_icons_gen TO 0;; + +CREATE TRIGGER t_phpbb_icons FOR phpbb_icons +BEFORE INSERT +AS +BEGIN + NEW.icons_id = GEN_ID(phpbb_icons_gen, 1); +END;; + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id INTEGER NOT NULL, + lang_iso VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + lang_dir VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + lang_english_name VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_local_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_author VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_lang ADD PRIMARY KEY (lang_id);; + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang(lang_iso);; + +CREATE GENERATOR phpbb_lang_gen;; +SET GENERATOR phpbb_lang_gen TO 0;; + +CREATE TRIGGER t_phpbb_lang FOR phpbb_lang +BEFORE INSERT +AS +BEGIN + NEW.lang_id = GEN_ID(phpbb_lang_gen, 1); +END;; + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id INTEGER 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, + reportee_id INTEGER DEFAULT 0 NOT NULL, + log_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + log_time INTEGER DEFAULT 0 NOT NULL, + log_operation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + log_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + album_id INTEGER DEFAULT 0 NOT NULL, + image_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_log ADD PRIMARY KEY (log_id);; + +CREATE INDEX phpbb_log_log_type ON phpbb_log(log_type);; +CREATE INDEX phpbb_log_log_time ON phpbb_log(log_time);; +CREATE INDEX phpbb_log_forum_id ON phpbb_log(forum_id);; +CREATE INDEX phpbb_log_topic_id ON phpbb_log(topic_id);; +CREATE INDEX phpbb_log_reportee_id ON phpbb_log(reportee_id);; +CREATE INDEX phpbb_log_user_id ON phpbb_log(user_id);; + +CREATE GENERATOR phpbb_log_gen;; +SET GENERATOR phpbb_log_gen TO 0;; + +CREATE TRIGGER t_phpbb_log FOR phpbb_log +BEFORE INSERT +AS +BEGIN + NEW.log_id = GEN_ID(phpbb_log_gen, 1); +END;; + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_time INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE, + username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE +);; + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);; +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);; +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);; +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);; + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + group_id INTEGER DEFAULT 0 NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + display_on_index INTEGER DEFAULT 1 NOT NULL +);; + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache(display_on_index);; +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache(forum_id);; + +# Table: 'phpbb_migrations' +CREATE TABLE phpbb_migrations ( + migration_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + migration_depends_on BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + migration_schema_done INTEGER DEFAULT 0 NOT NULL, + migration_data_done INTEGER DEFAULT 0 NOT NULL, + migration_data_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + migration_start_time INTEGER DEFAULT 0 NOT NULL, + migration_end_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_migrations ADD PRIMARY KEY (migration_name);; + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id INTEGER NOT NULL, + module_enabled INTEGER DEFAULT 1 NOT NULL, + module_display INTEGER DEFAULT 1 NOT NULL, + module_basename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_class VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + parent_id INTEGER DEFAULT 0 NOT NULL, + left_id INTEGER DEFAULT 0 NOT NULL, + right_id INTEGER DEFAULT 0 NOT NULL, + module_langname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_mode VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_auth VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_modules ADD PRIMARY KEY (module_id);; + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules(left_id, right_id);; +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules(module_enabled);; +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules(module_class, left_id);; + +CREATE GENERATOR phpbb_modules_gen;; +SET GENERATOR phpbb_modules_gen TO 0;; + +CREATE TRIGGER t_phpbb_modules FOR phpbb_modules +BEFORE INSERT +AS +BEGIN + NEW.module_id = GEN_ID(phpbb_modules_gen, 1); +END;; + + +# Table: 'phpbb_notification_types' +CREATE TABLE phpbb_notification_types ( + notification_type_id INTEGER NOT NULL, + notification_type_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + notification_type_enabled INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type_id);; + +CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types(notification_type_name);; + +CREATE GENERATOR phpbb_notification_types_gen;; +SET GENERATOR phpbb_notification_types_gen TO 0;; + +CREATE TRIGGER t_phpbb_notification_types FOR phpbb_notification_types +BEFORE INSERT +AS +BEGIN + NEW.notification_type_id = GEN_ID(phpbb_notification_types_gen, 1); +END;; + + +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id INTEGER NOT NULL, + notification_type_id INTEGER DEFAULT 0 NOT NULL, + item_id INTEGER DEFAULT 0 NOT NULL, + item_parent_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + notification_read INTEGER DEFAULT 0 NOT NULL, + notification_time INTEGER DEFAULT 1 NOT NULL, + notification_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);; + +CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(notification_type_id, item_id);; +CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);; + +CREATE GENERATOR phpbb_notifications_gen;; +SET GENERATOR phpbb_notifications_gen TO 0;; + +CREATE TRIGGER t_phpbb_notifications FOR phpbb_notifications +BEFORE INSERT +AS +BEGIN + NEW.notification_id = GEN_ID(phpbb_notifications_gen, 1); +END;; + + +# Table: 'phpbb_oauth_accounts' +CREATE TABLE phpbb_oauth_accounts ( + user_id INTEGER DEFAULT 0 NOT NULL, + provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + oauth_provider_id BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_oauth_accounts ADD PRIMARY KEY (user_id, provider);; + + +# Table: 'phpbb_oauth_tokens' +CREATE TABLE phpbb_oauth_tokens ( + user_id INTEGER DEFAULT 0 NOT NULL, + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + oauth_token BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens(user_id);; +CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens(provider);; + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + poll_option_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + poll_option_total INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options(poll_option_id);; +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options(topic_id);; + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id 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) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes(topic_id);; +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes(vote_user_id);; +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes(vote_user_ip);; + +# Table: 'phpbb_posts' +CREATE 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 0 NOT NULL, + poster_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_time INTEGER DEFAULT 0 NOT NULL, + post_visibility INTEGER DEFAULT 0 NOT NULL, + post_reported INTEGER DEFAULT 0 NOT NULL, + enable_bbcode INTEGER DEFAULT 1 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(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + post_checksum VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_attachment INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_postcount INTEGER DEFAULT 1 NOT NULL, + post_edit_time INTEGER DEFAULT 0 NOT NULL, + post_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_edit_user INTEGER DEFAULT 0 NOT NULL, + post_edit_count INTEGER DEFAULT 0 NOT NULL, + post_edit_locked INTEGER DEFAULT 0 NOT NULL, + post_delete_time INTEGER DEFAULT 0 NOT NULL, + post_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_delete_user INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_posts ADD PRIMARY KEY (post_id);; + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts(forum_id);; +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);; +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);; +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);; +CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts(post_visibility);; +CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);; +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);; + +CREATE GENERATOR phpbb_posts_gen;; +SET GENERATOR phpbb_posts_gen TO 0;; + +CREATE TRIGGER t_phpbb_posts FOR phpbb_posts +BEFORE INSERT +AS +BEGIN + NEW.post_id = GEN_ID(phpbb_posts_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id INTEGER NOT NULL, + root_level INTEGER DEFAULT 0 NOT NULL, + author_id INTEGER DEFAULT 0 NOT NULL, + icon_id INTEGER DEFAULT 0 NOT NULL, + author_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + message_time INTEGER DEFAULT 0 NOT NULL, + enable_bbcode INTEGER DEFAULT 1 NOT NULL, + enable_smilies INTEGER DEFAULT 1 NOT NULL, + enable_magic_url INTEGER DEFAULT 1 NOT NULL, + enable_sig INTEGER DEFAULT 1 NOT NULL, + message_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + message_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + message_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + message_edit_user INTEGER DEFAULT 0 NOT NULL, + message_attachment INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + message_edit_time INTEGER DEFAULT 0 NOT NULL, + message_edit_count INTEGER DEFAULT 0 NOT NULL, + to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + message_reported INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);; + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs(author_ip);; +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs(message_time);; +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs(author_id);; +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs(root_level);; + +CREATE GENERATOR phpbb_privmsgs_gen;; +SET GENERATOR phpbb_privmsgs_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs FOR phpbb_privmsgs +BEFORE INSERT +AS +BEGIN + NEW.msg_id = GEN_ID(phpbb_privmsgs_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + folder_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + pm_count INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs_folder ADD PRIMARY KEY (folder_id);; + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder(user_id);; + +CREATE GENERATOR phpbb_privmsgs_folder_gen;; +SET GENERATOR phpbb_privmsgs_folder_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs_folder FOR phpbb_privmsgs_folder +BEFORE INSERT +AS +BEGIN + NEW.folder_id = GEN_ID(phpbb_privmsgs_folder_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + rule_check INTEGER DEFAULT 0 NOT NULL, + rule_connection INTEGER DEFAULT 0 NOT NULL, + rule_string VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + rule_user_id INTEGER DEFAULT 0 NOT NULL, + rule_group_id INTEGER DEFAULT 0 NOT NULL, + rule_action INTEGER DEFAULT 0 NOT NULL, + rule_folder_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs_rules ADD PRIMARY KEY (rule_id);; + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules(user_id);; + +CREATE GENERATOR phpbb_privmsgs_rules_gen;; +SET GENERATOR phpbb_privmsgs_rules_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs_rules FOR phpbb_privmsgs_rules +BEFORE INSERT +AS +BEGIN + NEW.rule_id = GEN_ID(phpbb_privmsgs_rules_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + author_id INTEGER DEFAULT 0 NOT NULL, + pm_deleted INTEGER DEFAULT 0 NOT NULL, + pm_new INTEGER DEFAULT 1 NOT NULL, + pm_unread INTEGER DEFAULT 1 NOT NULL, + pm_replied INTEGER DEFAULT 0 NOT NULL, + pm_marked INTEGER DEFAULT 0 NOT NULL, + pm_forwarded INTEGER DEFAULT 0 NOT NULL, + folder_id INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to(msg_id);; +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to(author_id);; +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to(user_id, folder_id);; + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id INTEGER NOT NULL, + field_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_type INTEGER DEFAULT 0 NOT NULL, + field_ident VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_length VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_minlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_maxlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_novalue VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_required INTEGER DEFAULT 0 NOT NULL, + field_show_novalue INTEGER DEFAULT 0 NOT NULL, + field_show_on_reg INTEGER DEFAULT 0 NOT NULL, + field_show_on_pm INTEGER DEFAULT 0 NOT NULL, + field_show_on_vt INTEGER DEFAULT 0 NOT NULL, + field_show_profile INTEGER DEFAULT 0 NOT NULL, + field_hide INTEGER DEFAULT 0 NOT NULL, + field_no_view INTEGER DEFAULT 0 NOT NULL, + field_active INTEGER DEFAULT 0 NOT NULL, + field_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_profile_fields ADD PRIMARY KEY (field_id);; + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields(field_type);; +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields(field_order);; + +CREATE GENERATOR phpbb_profile_fields_gen;; +SET GENERATOR phpbb_profile_fields_gen TO 0;; + +CREATE TRIGGER t_phpbb_profile_fields FOR phpbb_profile_fields +BEFORE INSERT +AS +BEGIN + NEW.field_id = GEN_ID(phpbb_profile_fields_gen, 1); +END;; + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);; + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id INTEGER DEFAULT 0 NOT NULL, + lang_id INTEGER DEFAULT 0 NOT NULL, + option_id INTEGER DEFAULT 0 NOT NULL, + field_type INTEGER DEFAULT 0 NOT NULL, + lang_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_profile_fields_lang ADD PRIMARY KEY (field_id, lang_id, option_id);; + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id INTEGER DEFAULT 0 NOT NULL, + lang_id INTEGER DEFAULT 0 NOT NULL, + lang_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_explain BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + lang_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_profile_lang ADD PRIMARY KEY (field_id, lang_id);; + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id INTEGER NOT NULL, + rank_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + rank_min INTEGER DEFAULT 0 NOT NULL, + rank_special INTEGER DEFAULT 0 NOT NULL, + rank_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_ranks ADD PRIMARY KEY (rank_id);; + + +CREATE GENERATOR phpbb_ranks_gen;; +SET GENERATOR phpbb_ranks_gen TO 0;; + +CREATE TRIGGER t_phpbb_ranks FOR phpbb_ranks +BEFORE INSERT +AS +BEGIN + NEW.rank_id = GEN_ID(phpbb_ranks_gen, 1); +END;; + + +# 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, + pm_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + user_notify INTEGER DEFAULT 0 NOT NULL, + report_closed INTEGER DEFAULT 0 NOT NULL, + report_time INTEGER DEFAULT 0 NOT NULL, + report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + reported_post_enable_magic_url INTEGER DEFAULT 1 NOT NULL, + reported_post_enable_smilies INTEGER DEFAULT 1 NOT NULL, + reported_post_enable_bbcode INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);; +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);; + +CREATE GENERATOR phpbb_reports_gen;; +SET GENERATOR phpbb_reports_gen TO 0;; + +CREATE TRIGGER t_phpbb_reports FOR phpbb_reports +BEFORE INSERT +AS +BEGIN + NEW.report_id = GEN_ID(phpbb_reports_gen, 1); +END;; + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id INTEGER NOT NULL, + reason_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + reason_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reason_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_reports_reasons ADD PRIMARY KEY (reason_id);; + + +CREATE GENERATOR phpbb_reports_reasons_gen;; +SET GENERATOR phpbb_reports_reasons_gen TO 0;; + +CREATE TRIGGER t_phpbb_reports_reasons FOR phpbb_reports_reasons +BEFORE INSERT +AS +BEGIN + NEW.reason_id = GEN_ID(phpbb_reports_reasons_gen, 1); +END;; + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + search_time INTEGER DEFAULT 0 NOT NULL, + search_keywords BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + search_authors BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);; + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id INTEGER NOT NULL, + word_text VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + word_common INTEGER DEFAULT 0 NOT NULL, + word_count INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_search_wordlist ADD PRIMARY KEY (word_id);; + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist(word_text);; +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist(word_count);; + +CREATE GENERATOR phpbb_search_wordlist_gen;; +SET GENERATOR phpbb_search_wordlist_gen TO 0;; + +CREATE TRIGGER t_phpbb_search_wordlist FOR phpbb_search_wordlist +BEFORE INSERT +AS +BEGIN + NEW.word_id = GEN_ID(phpbb_search_wordlist_gen, 1); +END;; + + +# 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 +);; + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch(word_id, post_id, title_match);; +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch(word_id);; +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch(post_id);; + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_user_id INTEGER DEFAULT 0 NOT NULL, + session_forum_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) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_page VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + session_viewonline INTEGER DEFAULT 1 NOT NULL, + session_autologin INTEGER DEFAULT 0 NOT NULL, + session_admin INTEGER DEFAULT 0 NOT NULL, + session_album_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sessions ADD PRIMARY KEY (session_id);; + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions(session_time);; +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions(session_user_id);; +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions(session_forum_id);; +CREATE INDEX phpbb_sessions_session_aid ON phpbb_sessions(session_album_id);; + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + last_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + last_login INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sessions_keys ADD PRIMARY KEY (key_id, user_id);; + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys(last_login);; + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id INTEGER NOT NULL, + site_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + site_hostname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + ip_exclude INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sitelist ADD PRIMARY KEY (site_id);; + + +CREATE GENERATOR phpbb_sitelist_gen;; +SET GENERATOR phpbb_sitelist_gen TO 0;; + +CREATE TRIGGER t_phpbb_sitelist FOR phpbb_sitelist +BEFORE INSERT +AS +BEGIN + NEW.site_id = GEN_ID(phpbb_sitelist_gen, 1); +END;; + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id INTEGER NOT NULL, + code VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + emotion VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + smiley_url VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, + smiley_width INTEGER DEFAULT 0 NOT NULL, + smiley_height INTEGER DEFAULT 0 NOT NULL, + smiley_order INTEGER DEFAULT 0 NOT NULL, + display_on_posting INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_smilies ADD PRIMARY KEY (smiley_id);; + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies(display_on_posting);; + +CREATE GENERATOR phpbb_smilies_gen;; +SET GENERATOR phpbb_smilies_gen TO 0;; + +CREATE TRIGGER t_phpbb_smilies FOR phpbb_smilies +BEFORE INSERT +AS +BEGIN + NEW.smiley_id = GEN_ID(phpbb_smilies_gen, 1); +END;; + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id INTEGER NOT NULL, + style_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + style_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + style_active INTEGER DEFAULT 1 NOT NULL, + style_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT 'kNg=' NOT NULL, + style_parent_id INTEGER DEFAULT 0 NOT NULL, + style_parent_tree BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_styles ADD PRIMARY KEY (style_id);; + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles(style_name);; + +CREATE GENERATOR phpbb_styles_gen;; +SET GENERATOR phpbb_styles_gen TO 0;; + +CREATE TRIGGER t_phpbb_styles FOR phpbb_styles +BEFORE INSERT +AS +BEGIN + NEW.style_id = GEN_ID(phpbb_styles_gen, 1); +END;; + + +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id INTEGER NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL, + teampage_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + teampage_position INTEGER DEFAULT 0 NOT NULL, + teampage_parent INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_teampage ADD PRIMARY KEY (teampage_id);; + + +CREATE GENERATOR phpbb_teampage_gen;; +SET GENERATOR phpbb_teampage_gen TO 0;; + +CREATE TRIGGER t_phpbb_teampage FOR phpbb_teampage +BEFORE INSERT +AS +BEGIN + NEW.teampage_id = GEN_ID(phpbb_teampage_gen, 1); +END;; + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id INTEGER NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + icon_id INTEGER DEFAULT 0 NOT NULL, + topic_attachment INTEGER DEFAULT 0 NOT NULL, + topic_visibility INTEGER DEFAULT 0 NOT NULL, + topic_reported INTEGER DEFAULT 0 NOT NULL, + topic_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_poster INTEGER DEFAULT 0 NOT NULL, + topic_time INTEGER DEFAULT 0 NOT NULL, + topic_time_limit INTEGER DEFAULT 0 NOT NULL, + topic_views INTEGER DEFAULT 0 NOT NULL, + topic_posts_approved INTEGER DEFAULT 0 NOT NULL, + topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL, + topic_posts_softdeleted 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(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_first_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + topic_last_post_id INTEGER DEFAULT 0 NOT NULL, + topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, + topic_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + topic_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + 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, + topic_bumped INTEGER DEFAULT 0 NOT NULL, + topic_bumper INTEGER DEFAULT 0 NOT NULL, + poll_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + 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 DEFAULT 0 NOT NULL, + poll_vote_change INTEGER DEFAULT 0 NOT NULL, + topic_delete_time INTEGER DEFAULT 0 NOT NULL, + topic_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_delete_user INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);; + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);; +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);; +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics(topic_last_post_time);; +CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics(topic_visibility);; +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_visibility, topic_last_post_id);; +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics(forum_id, topic_last_post_time, topic_moved_id);; + +CREATE GENERATOR phpbb_topics_gen;; +SET GENERATOR phpbb_topics_gen TO 0;; + +CREATE TRIGGER t_phpbb_topics FOR phpbb_topics +BEFORE INSERT +AS +BEGIN + NEW.topic_id = GEN_ID(phpbb_topics_gen, 1); +END;; + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + mark_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics_track ADD PRIMARY KEY (user_id, topic_id);; + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track(topic_id);; +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track(forum_id);; + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + topic_posted INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics_posted ADD PRIMARY KEY (user_id, topic_id);; + + +# 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 +);; + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; + +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + item_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + notify INTEGER DEFAULT 1 NOT NULL +);; + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + group_leader INTEGER DEFAULT 0 NOT NULL, + user_pending INTEGER DEFAULT 1 NOT NULL +);; + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group(group_id);; +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group(user_id);; +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group(group_leader);; + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id INTEGER NOT NULL, + user_type INTEGER DEFAULT 0 NOT NULL, + group_id INTEGER DEFAULT 3 NOT NULL, + user_permissions BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + user_perm_from INTEGER DEFAULT 0 NOT NULL, + user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_regdate INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_passchg INTEGER DEFAULT 0 NOT NULL, + user_pass_convert INTEGER DEFAULT 0 NOT NULL, + user_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_email_hash DOUBLE PRECISION DEFAULT 0 NOT NULL, + user_birthday VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_lastvisit INTEGER DEFAULT 0 NOT NULL, + user_lastmark INTEGER DEFAULT 0 NOT NULL, + user_lastpost_time INTEGER DEFAULT 0 NOT NULL, + user_lastpage VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_last_confirm_key VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_last_search INTEGER DEFAULT 0 NOT NULL, + user_warnings INTEGER DEFAULT 0 NOT NULL, + user_last_warning INTEGER DEFAULT 0 NOT NULL, + user_login_attempts INTEGER DEFAULT 0 NOT NULL, + user_inactive_reason INTEGER DEFAULT 0 NOT NULL, + user_inactive_time INTEGER DEFAULT 0 NOT NULL, + user_posts INTEGER DEFAULT 0 NOT NULL, + user_lang VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_timezone VARCHAR(100) CHARACTER SET NONE DEFAULT 'UTC' NOT NULL, + user_dateformat VARCHAR(30) CHARACTER SET UTF8 DEFAULT 'd M Y H:i' NOT NULL COLLATE UNICODE, + user_style INTEGER DEFAULT 0 NOT NULL, + user_rank INTEGER DEFAULT 0 NOT NULL, + user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' 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_message_rules INTEGER DEFAULT 0 NOT NULL, + user_full_folder INTEGER DEFAULT -3 NOT NULL, + user_emailtime INTEGER DEFAULT 0 NOT NULL, + user_topic_show_days INTEGER DEFAULT 0 NOT NULL, + user_topic_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, + user_topic_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'd' NOT NULL, + user_post_show_days INTEGER DEFAULT 0 NOT NULL, + user_post_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, + user_post_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'a' NOT NULL, + user_notify INTEGER DEFAULT 0 NOT NULL, + user_notify_pm INTEGER DEFAULT 1 NOT NULL, + user_notify_type INTEGER DEFAULT 0 NOT NULL, + user_allow_pm 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_options INTEGER DEFAULT 230271 NOT NULL, + user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_avatar_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_avatar_width INTEGER DEFAULT 0 NOT NULL, + user_avatar_height INTEGER DEFAULT 0 NOT NULL, + user_sig BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_sig_bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_from VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_icq VARCHAR(15) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_aim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_yim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_occ BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_new INTEGER DEFAULT 1 NOT NULL, + user_reminded INTEGER DEFAULT 0 NOT NULL, + user_reminded_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; +CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; + +CREATE GENERATOR phpbb_users_gen;; +SET GENERATOR phpbb_users_gen TO 0;; + +CREATE TRIGGER t_phpbb_users FOR phpbb_users +BEFORE INSERT +AS +BEGIN + NEW.user_id = GEN_ID(phpbb_users_gen, 1); +END;; + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + post_id INTEGER DEFAULT 0 NOT NULL, + log_id INTEGER DEFAULT 0 NOT NULL, + warning_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_warnings ADD PRIMARY KEY (warning_id);; + + +CREATE GENERATOR phpbb_warnings_gen;; +SET GENERATOR phpbb_warnings_gen TO 0;; + +CREATE TRIGGER t_phpbb_warnings FOR phpbb_warnings +BEFORE INSERT +AS +BEGIN + NEW.warning_id = GEN_ID(phpbb_warnings_gen, 1); +END;; + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id INTEGER NOT NULL, + word VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + replacement VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_words ADD PRIMARY KEY (word_id);; + + +CREATE GENERATOR phpbb_words_gen;; +SET GENERATOR phpbb_words_gen TO 0;; + +CREATE TRIGGER t_phpbb_words FOR phpbb_words +BEFORE INSERT +AS +BEGIN + NEW.word_id = GEN_ID(phpbb_words_gen, 1); +END;; + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id INTEGER DEFAULT 0 NOT NULL, + zebra_id INTEGER DEFAULT 0 NOT NULL, + friend INTEGER DEFAULT 0 NOT NULL, + foe INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_zebra ADD PRIMARY KEY (user_id, zebra_id);; + + +# Table: 'phpbb_gallery_albums' +CREATE TABLE phpbb_gallery_albums ( + album_id INTEGER NOT NULL, + parent_id INTEGER DEFAULT 0 NOT NULL, + left_id INTEGER DEFAULT 1 NOT NULL, + right_id INTEGER DEFAULT 2 NOT NULL, + album_parents BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + album_type INTEGER DEFAULT 1 NOT NULL, + album_status INTEGER DEFAULT 1 NOT NULL, + album_contest INTEGER DEFAULT 0 NOT NULL, + album_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + album_desc_options INTEGER DEFAULT 7 NOT NULL, + album_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_user_id INTEGER DEFAULT 0 NOT NULL, + album_images INTEGER DEFAULT 0 NOT NULL, + album_images_real INTEGER DEFAULT 0 NOT NULL, + album_last_image_id INTEGER DEFAULT 0 NOT NULL, + album_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_last_image_time INTEGER DEFAULT 0 NOT NULL, + album_last_image_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_last_username VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_last_user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_last_user_id INTEGER DEFAULT 0 NOT NULL, + album_watermark INTEGER DEFAULT 1 NOT NULL, + album_sort_key VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + album_sort_dir VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + display_in_rrc INTEGER DEFAULT 1 NOT NULL, + display_on_index INTEGER DEFAULT 1 NOT NULL, + display_subalbum_list INTEGER DEFAULT 1 NOT NULL, + album_feed INTEGER DEFAULT 1 NOT NULL, + album_auth_access INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_albums ADD PRIMARY KEY (album_id);; + + +CREATE GENERATOR phpbb_gallery_albums_gen;; +SET GENERATOR phpbb_gallery_albums_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_albums FOR phpbb_gallery_albums +BEFORE INSERT +AS +BEGIN + NEW.album_id = GEN_ID(phpbb_gallery_albums_gen, 1); +END;; + + +# Table: 'phpbb_gallery_albums_track' +CREATE TABLE phpbb_gallery_albums_track ( + user_id INTEGER DEFAULT 0 NOT NULL, + album_id INTEGER DEFAULT 0 NOT NULL, + mark_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_albums_track ADD PRIMARY KEY (user_id, album_id);; + + +# Table: 'phpbb_gallery_comments' +CREATE TABLE phpbb_gallery_comments ( + comment_id INTEGER NOT NULL, + comment_image_id INTEGER NOT NULL, + comment_user_id INTEGER DEFAULT 0 NOT NULL, + comment_username VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + comment_user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + comment_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + comment_signature INTEGER DEFAULT 0 NOT NULL, + comment_time INTEGER DEFAULT 0 NOT NULL, + comment BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + comment_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + comment_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + comment_edit_time INTEGER DEFAULT 0 NOT NULL, + comment_edit_count INTEGER DEFAULT 0 NOT NULL, + comment_edit_user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_comments ADD PRIMARY KEY (comment_id);; + +CREATE INDEX phpbb_gallery_comments_id ON phpbb_gallery_comments(comment_image_id);; +CREATE INDEX phpbb_gallery_comments_uid ON phpbb_gallery_comments(comment_user_id);; +CREATE INDEX phpbb_gallery_comments_ip ON phpbb_gallery_comments(comment_user_ip);; +CREATE INDEX phpbb_gallery_comments_time ON phpbb_gallery_comments(comment_time);; + +CREATE GENERATOR phpbb_gallery_comments_gen;; +SET GENERATOR phpbb_gallery_comments_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_comments FOR phpbb_gallery_comments +BEFORE INSERT +AS +BEGIN + NEW.comment_id = GEN_ID(phpbb_gallery_comments_gen, 1); +END;; + + +# Table: 'phpbb_gallery_contests' +CREATE TABLE phpbb_gallery_contests ( + contest_id INTEGER NOT NULL, + contest_album_id INTEGER DEFAULT 0 NOT NULL, + contest_start INTEGER DEFAULT 0 NOT NULL, + contest_rating INTEGER DEFAULT 0 NOT NULL, + contest_end INTEGER DEFAULT 0 NOT NULL, + contest_marked INTEGER DEFAULT 0 NOT NULL, + contest_first INTEGER DEFAULT 0 NOT NULL, + contest_second INTEGER DEFAULT 0 NOT NULL, + contest_third INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_contests ADD PRIMARY KEY (contest_id);; + + +CREATE GENERATOR phpbb_gallery_contests_gen;; +SET GENERATOR phpbb_gallery_contests_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_contests FOR phpbb_gallery_contests +BEFORE INSERT +AS +BEGIN + NEW.contest_id = GEN_ID(phpbb_gallery_contests_gen, 1); +END;; + + +# Table: 'phpbb_gallery_favorites' +CREATE TABLE phpbb_gallery_favorites ( + favorite_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + image_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_favorites ADD PRIMARY KEY (favorite_id);; + +CREATE INDEX phpbb_gallery_favorites_uid ON phpbb_gallery_favorites(user_id);; +CREATE INDEX phpbb_gallery_favorites_id ON phpbb_gallery_favorites(image_id);; + +CREATE GENERATOR phpbb_gallery_favorites_gen;; +SET GENERATOR phpbb_gallery_favorites_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_favorites FOR phpbb_gallery_favorites +BEFORE INSERT +AS +BEGIN + NEW.favorite_id = GEN_ID(phpbb_gallery_favorites_gen, 1); +END;; + + +# Table: 'phpbb_gallery_images' +CREATE TABLE phpbb_gallery_images ( + image_id INTEGER NOT NULL, + image_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_name_clean VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + image_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_user_id INTEGER DEFAULT 0 NOT NULL, + image_username VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_username_clean VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + image_time INTEGER DEFAULT 0 NOT NULL, + image_album_id INTEGER DEFAULT 0 NOT NULL, + image_view_count INTEGER DEFAULT 0 NOT NULL, + image_status INTEGER DEFAULT 0 NOT NULL, + image_contest INTEGER DEFAULT 0 NOT NULL, + image_contest_end INTEGER DEFAULT 0 NOT NULL, + image_contest_rank INTEGER DEFAULT 0 NOT NULL, + image_filemissing INTEGER DEFAULT 0 NOT NULL, + image_has_exif INTEGER DEFAULT 2 NOT NULL, + image_exif_data BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + image_rates INTEGER DEFAULT 0 NOT NULL, + image_rate_points INTEGER DEFAULT 0 NOT NULL, + image_rate_avg INTEGER DEFAULT 0 NOT NULL, + image_comments INTEGER DEFAULT 0 NOT NULL, + image_last_comment INTEGER DEFAULT 0 NOT NULL, + image_allow_comments INTEGER DEFAULT 1 NOT NULL, + image_favorited INTEGER DEFAULT 0 NOT NULL, + image_reported INTEGER DEFAULT 0 NOT NULL, + filesize_upload INTEGER DEFAULT 0 NOT NULL, + filesize_medium INTEGER DEFAULT 0 NOT NULL, + filesize_cache INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_images ADD PRIMARY KEY (image_id);; + +CREATE INDEX phpbb_gallery_images_aid ON phpbb_gallery_images(image_album_id);; +CREATE INDEX phpbb_gallery_images_uid ON phpbb_gallery_images(image_user_id);; +CREATE INDEX phpbb_gallery_images_time ON phpbb_gallery_images(image_time);; + +CREATE GENERATOR phpbb_gallery_images_gen;; +SET GENERATOR phpbb_gallery_images_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_images FOR phpbb_gallery_images +BEFORE INSERT +AS +BEGIN + NEW.image_id = GEN_ID(phpbb_gallery_images_gen, 1); +END;; + + +# Table: 'phpbb_gallery_modscache' +CREATE TABLE phpbb_gallery_modscache ( + album_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL, + group_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + display_on_index INTEGER DEFAULT 1 NOT NULL +);; + +CREATE INDEX phpbb_gallery_modscache_doi ON phpbb_gallery_modscache(display_on_index);; +CREATE INDEX phpbb_gallery_modscache_aid ON phpbb_gallery_modscache(album_id);; + +# Table: 'phpbb_gallery_permissions' +CREATE TABLE phpbb_gallery_permissions ( + perm_id INTEGER NOT NULL, + perm_role_id INTEGER DEFAULT 0 NOT NULL, + perm_album_id INTEGER DEFAULT 0 NOT NULL, + perm_user_id INTEGER DEFAULT 0 NOT NULL, + perm_group_id INTEGER DEFAULT 0 NOT NULL, + perm_system INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_permissions ADD PRIMARY KEY (perm_id);; + + +CREATE GENERATOR phpbb_gallery_permissions_gen;; +SET GENERATOR phpbb_gallery_permissions_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_permissions FOR phpbb_gallery_permissions +BEFORE INSERT +AS +BEGIN + NEW.perm_id = GEN_ID(phpbb_gallery_permissions_gen, 1); +END;; + + +# Table: 'phpbb_gallery_rates' +CREATE TABLE phpbb_gallery_rates ( + rate_image_id INTEGER DEFAULT 0 NOT NULL, + rate_user_id INTEGER DEFAULT 0 NOT NULL, + rate_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + rate_point INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_rates ADD PRIMARY KEY (rate_image_id, rate_user_id);; + + +# Table: 'phpbb_gallery_reports' +CREATE TABLE phpbb_gallery_reports ( + report_id INTEGER NOT NULL, + report_album_id INTEGER DEFAULT 0 NOT NULL, + report_image_id INTEGER DEFAULT 0 NOT NULL, + reporter_id INTEGER DEFAULT 0 NOT NULL, + report_manager INTEGER DEFAULT 0 NOT NULL, + report_note BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + report_time INTEGER DEFAULT 0 NOT NULL, + report_status INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_reports ADD PRIMARY KEY (report_id);; + + +CREATE GENERATOR phpbb_gallery_reports_gen;; +SET GENERATOR phpbb_gallery_reports_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_reports FOR phpbb_gallery_reports +BEFORE INSERT +AS +BEGIN + NEW.report_id = GEN_ID(phpbb_gallery_reports_gen, 1); +END;; + + +# Table: 'phpbb_gallery_roles' +CREATE TABLE phpbb_gallery_roles ( + role_id INTEGER NOT NULL, + a_list INTEGER DEFAULT 0 NOT NULL, + i_view INTEGER DEFAULT 0 NOT NULL, + i_watermark INTEGER DEFAULT 0 NOT NULL, + i_upload INTEGER DEFAULT 0 NOT NULL, + i_edit INTEGER DEFAULT 0 NOT NULL, + i_delete INTEGER DEFAULT 0 NOT NULL, + i_rate INTEGER DEFAULT 0 NOT NULL, + i_approve INTEGER DEFAULT 0 NOT NULL, + i_lock INTEGER DEFAULT 0 NOT NULL, + i_report INTEGER DEFAULT 0 NOT NULL, + i_count INTEGER DEFAULT 0 NOT NULL, + i_unlimited INTEGER DEFAULT 0 NOT NULL, + c_read INTEGER DEFAULT 0 NOT NULL, + c_post INTEGER DEFAULT 0 NOT NULL, + c_edit INTEGER DEFAULT 0 NOT NULL, + c_delete INTEGER DEFAULT 0 NOT NULL, + m_comments INTEGER DEFAULT 0 NOT NULL, + m_delete INTEGER DEFAULT 0 NOT NULL, + m_edit INTEGER DEFAULT 0 NOT NULL, + m_move INTEGER DEFAULT 0 NOT NULL, + m_report INTEGER DEFAULT 0 NOT NULL, + m_status INTEGER DEFAULT 0 NOT NULL, + a_count INTEGER DEFAULT 0 NOT NULL, + a_unlimited INTEGER DEFAULT 0 NOT NULL, + a_restrict INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_roles ADD PRIMARY KEY (role_id);; + + +CREATE GENERATOR phpbb_gallery_roles_gen;; +SET GENERATOR phpbb_gallery_roles_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_roles FOR phpbb_gallery_roles +BEFORE INSERT +AS +BEGIN + NEW.role_id = GEN_ID(phpbb_gallery_roles_gen, 1); +END;; + + +# Table: 'phpbb_gallery_users' +CREATE TABLE phpbb_gallery_users ( + user_id INTEGER DEFAULT 0 NOT NULL, + watch_own INTEGER DEFAULT 0 NOT NULL, + watch_favo INTEGER DEFAULT 0 NOT NULL, + watch_com INTEGER DEFAULT 0 NOT NULL, + user_images INTEGER DEFAULT 0 NOT NULL, + personal_album_id INTEGER DEFAULT 0 NOT NULL, + user_lastmark INTEGER DEFAULT 0 NOT NULL, + user_last_update INTEGER DEFAULT 0 NOT NULL, + user_viewexif INTEGER DEFAULT 0 NOT NULL, + user_permissions BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_permissions_changed INTEGER DEFAULT 0 NOT NULL, + user_allow_comments INTEGER DEFAULT 1 NOT NULL, + subscribe_pegas INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_users ADD PRIMARY KEY (user_id);; + +CREATE INDEX phpbb_gallery_users_pega ON phpbb_gallery_users(personal_album_id);; + +# Table: 'phpbb_gallery_watch' +CREATE TABLE phpbb_gallery_watch ( + watch_id INTEGER NOT NULL, + album_id INTEGER DEFAULT 0 NOT NULL, + image_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_gallery_watch ADD PRIMARY KEY (watch_id);; + +CREATE INDEX phpbb_gallery_watch_uid ON phpbb_gallery_watch(user_id);; +CREATE INDEX phpbb_gallery_watch_id ON phpbb_gallery_watch(image_id);; +CREATE INDEX phpbb_gallery_watch_aid ON phpbb_gallery_watch(album_id);; + +CREATE GENERATOR phpbb_gallery_watch_gen;; +SET GENERATOR phpbb_gallery_watch_gen TO 0;; + +CREATE TRIGGER t_phpbb_gallery_watch FOR phpbb_gallery_watch +BEFORE INSERT +AS +BEGIN + NEW.watch_id = GEN_ID(phpbb_gallery_watch_gen, 1); +END;; + + diff --git a/tests/schemas/mssql_schema.sql b/tests/schemas/mssql_schema.sql new file mode 100644 index 00000000..bc1ae72e --- /dev/null +++ b/tests/schemas/mssql_schema.sql @@ -0,0 +1,2231 @@ +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +/* + Table: 'phpbb_attachments' +*/ +CREATE TABLE [phpbb_attachments] ( + [attach_id] [int] IDENTITY (1, 1) NOT NULL , + [post_msg_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [in_message] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [is_orphan] [int] DEFAULT (1) NOT NULL , + [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [download_count] [int] DEFAULT (0) NOT NULL , + [attach_comment] [varchar] (4000) DEFAULT ('') NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL , + [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , + [filesize] [int] DEFAULT (0) NOT NULL , + [filetime] [int] DEFAULT (0) NOT NULL , + [thumbnail] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED + ( + [attach_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] +GO + +CREATE INDEX [post_msg_id] ON [phpbb_attachments]([post_msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_attachments]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE [phpbb_acl_groups] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_acl_groups]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE [phpbb_acl_options] ( + [auth_option_id] [int] IDENTITY (1, 1) NOT NULL , + [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , + [is_global] [int] DEFAULT (0) NOT NULL , + [is_local] [int] DEFAULT (0) NOT NULL , + [founder_only] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED + ( + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE [phpbb_acl_roles] ( + [role_id] [int] IDENTITY (1, 1) NOT NULL , + [role_name] [varchar] (255) DEFAULT ('') NOT NULL , + [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , + [role_type] [varchar] (10) DEFAULT ('') NOT NULL , + [role_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED + ( + [role_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] +GO + +CREATE INDEX [role_order] ON [phpbb_acl_roles]([role_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE [phpbb_acl_roles_data] ( + [role_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED + ( + [role_id], + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE [phpbb_acl_users] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_acl_users]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE [phpbb_banlist] ( + [ban_id] [int] IDENTITY (1, 1) NOT NULL , + [ban_userid] [int] DEFAULT (0) NOT NULL , + [ban_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [ban_email] [varchar] (100) DEFAULT ('') NOT NULL , + [ban_start] [int] DEFAULT (0) NOT NULL , + [ban_end] [int] DEFAULT (0) NOT NULL , + [ban_exclude] [int] DEFAULT (0) NOT NULL , + [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED + ( + [ban_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] +GO + +CREATE INDEX [ban_user] ON [phpbb_banlist]([ban_userid], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_email] ON [phpbb_banlist]([ban_email], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_ip] ON [phpbb_banlist]([ban_ip], [ban_exclude]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE [phpbb_bbcodes] ( + [bbcode_id] [int] DEFAULT (0) NOT NULL , + [bbcode_tag] [varchar] (16) DEFAULT ('') NOT NULL , + [bbcode_helpline] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_posting] [int] DEFAULT (0) NOT NULL , + [bbcode_match] [varchar] (4000) DEFAULT ('') NOT NULL , + [bbcode_tpl] [text] DEFAULT ('') NOT NULL , + [first_pass_match] [text] DEFAULT ('') NOT NULL , + [first_pass_replace] [text] DEFAULT ('') NOT NULL , + [second_pass_match] [text] DEFAULT ('') NOT NULL , + [second_pass_replace] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED + ( + [bbcode_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE [phpbb_bookmarks] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED + ( + [topic_id], + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE [phpbb_bots] ( + [bot_id] [int] IDENTITY (1, 1) NOT NULL , + [bot_active] [int] DEFAULT (1) NOT NULL , + [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , + [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bots] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED + ( + [bot_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE [phpbb_config] ( + [config_name] [varchar] (255) DEFAULT ('') NOT NULL , + [config_value] [varchar] (255) DEFAULT ('') NOT NULL , + [is_dynamic] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_config] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED + ( + [config_name] + ) ON [PRIMARY] +GO + +CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_config_text' +*/ +CREATE TABLE [phpbb_config_text] ( + [config_name] [varchar] (255) DEFAULT ('') NOT NULL , + [config_value] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_config_text] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config_text] PRIMARY KEY CLUSTERED + ( + [config_name] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE [phpbb_confirm] ( + [confirm_id] [char] (32) DEFAULT ('') NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [confirm_type] [int] DEFAULT (0) NOT NULL , + [code] [varchar] (8) DEFAULT ('') NOT NULL , + [seed] [int] DEFAULT (0) NOT NULL , + [attempts] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED + ( + [session_id], + [confirm_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE [phpbb_disallow] ( + [disallow_id] [int] IDENTITY (1, 1) NOT NULL , + [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED + ( + [disallow_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_drafts' +*/ +CREATE TABLE [phpbb_drafts] ( + [draft_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [save_time] [int] DEFAULT (0) NOT NULL , + [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [draft_message] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED + ( + [draft_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE [phpbb_ext] ( + [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , + [ext_active] [int] DEFAULT (0) NOT NULL , + [ext_state] [varchar] (8000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extensions' +*/ +CREATE TABLE [phpbb_extensions] ( + [extension_id] [int] IDENTITY (1, 1) NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED + ( + [extension_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE TABLE [phpbb_extension_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [cat_id] [int] DEFAULT (0) NOT NULL , + [allow_group] [int] DEFAULT (0) NOT NULL , + [download_mode] [int] DEFAULT (1) NOT NULL , + [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , + [max_filesize] [int] DEFAULT (0) NOT NULL , + [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , + [allow_in_pm] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE [phpbb_forums] ( + [forum_id] [int] IDENTITY (1, 1) NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [forum_parents] [text] DEFAULT ('') NOT NULL , + [forum_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc_options] [int] DEFAULT (7) NOT NULL , + [forum_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_password] [varchar] (40) DEFAULT ('') NOT NULL , + [forum_style] [int] DEFAULT (0) NOT NULL , + [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_options] [int] DEFAULT (7) NOT NULL , + [forum_rules_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , + [forum_type] [int] DEFAULT (0) NOT NULL , + [forum_status] [int] DEFAULT (0) NOT NULL , + [forum_posts_approved] [int] DEFAULT (0) NOT NULL , + [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL , + [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL , + [forum_topics_approved] [int] DEFAULT (0) NOT NULL , + [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL , + [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL , + [forum_last_post_id] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , + [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_post_time] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [forum_flags] [int] DEFAULT (32) NOT NULL , + [forum_options] [int] DEFAULT (0) NOT NULL , + [display_subforum_list] [int] DEFAULT (1) NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL , + [enable_indexing] [int] DEFAULT (1) NOT NULL , + [enable_icons] [int] DEFAULT (1) NOT NULL , + [enable_prune] [int] DEFAULT (0) NOT NULL , + [prune_next] [int] DEFAULT (0) NOT NULL , + [prune_days] [int] DEFAULT (0) NOT NULL , + [prune_viewed] [int] DEFAULT (0) NOT NULL , + [prune_freq] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED + ( + [forum_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_lastpost_id] ON [phpbb_forums]([forum_last_post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE [phpbb_forums_access] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED + ( + [forum_id], + [user_id], + [session_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE [phpbb_forums_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [forum_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE [phpbb_forums_watch] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_forums_watch]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_forums_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_forums_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE [phpbb_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_type] [int] DEFAULT (1) NOT NULL , + [group_founder_manage] [int] DEFAULT (0) NOT NULL , + [group_skip_auth] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc_options] [int] DEFAULT (7) NOT NULL , + [group_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [group_display] [int] DEFAULT (0) NOT NULL , + [group_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [group_avatar_type] [varchar] (255) DEFAULT ('') NOT NULL , + [group_avatar_width] [int] DEFAULT (0) NOT NULL , + [group_avatar_height] [int] DEFAULT (0) NOT NULL , + [group_rank] [int] DEFAULT (0) NOT NULL , + [group_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [group_sig_chars] [int] DEFAULT (0) NOT NULL , + [group_receive_pm] [int] DEFAULT (0) NOT NULL , + [group_message_limit] [int] DEFAULT (0) NOT NULL , + [group_max_recipients] [int] DEFAULT (0) NOT NULL , + [group_legend] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE [phpbb_icons] ( + [icons_id] [int] IDENTITY (1, 1) NOT NULL , + [icons_url] [varchar] (255) DEFAULT ('') NOT NULL , + [icons_width] [int] DEFAULT (0) NOT NULL , + [icons_height] [int] DEFAULT (0) NOT NULL , + [icons_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_icons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED + ( + [icons_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE [phpbb_lang] ( + [lang_id] [int] IDENTITY (1, 1) NOT NULL , + [lang_iso] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , + [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_author] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED + ( + [lang_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_log' +*/ +CREATE TABLE [phpbb_log] ( + [log_id] [int] IDENTITY (1, 1) NOT NULL , + [log_type] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [reportee_id] [int] DEFAULT (0) NOT NULL , + [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [log_time] [int] DEFAULT (0) NOT NULL , + [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , + [log_data] [text] DEFAULT ('') NOT NULL , + [album_id] [int] DEFAULT (0) NOT NULL , + [image_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_log] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED + ( + [log_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] +GO + +CREATE INDEX [log_time] ON [phpbb_log]([log_time]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_log]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_log]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [reportee_id] ON [phpbb_log]([reportee_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_log]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE [phpbb_login_attempts] ( + [attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL , + [attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , + [attempt_time] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT (0) NOT NULL , + [username_clean] [varchar] (255) DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [att_for] ON [phpbb_login_attempts]([attempt_forwarded_for], [attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [att_time] ON [phpbb_login_attempts]([attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE [phpbb_moderator_cache] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [disp_idx] ON [phpbb_moderator_cache]([display_on_index]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_migrations' +*/ +CREATE TABLE [phpbb_migrations] ( + [migration_name] [varchar] (255) DEFAULT ('') NOT NULL , + [migration_depends_on] [varchar] (8000) DEFAULT ('') NOT NULL , + [migration_schema_done] [int] DEFAULT (0) NOT NULL , + [migration_data_done] [int] DEFAULT (0) NOT NULL , + [migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL , + [migration_start_time] [int] DEFAULT (0) NOT NULL , + [migration_end_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_migrations] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_migrations] PRIMARY KEY CLUSTERED + ( + [migration_name] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE [phpbb_modules] ( + [module_id] [int] IDENTITY (1, 1) NOT NULL , + [module_enabled] [int] DEFAULT (1) NOT NULL , + [module_display] [int] DEFAULT (1) NOT NULL , + [module_basename] [varchar] (255) DEFAULT ('') NOT NULL , + [module_class] [varchar] (10) DEFAULT ('') NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , + [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , + [module_auth] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_modules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED + ( + [module_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [module_enabled] ON [phpbb_modules]([module_enabled]) ON [PRIMARY] +GO + +CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_notification_types' +*/ +CREATE TABLE [phpbb_notification_types] ( + [notification_type_id] [int] IDENTITY (1, 1) NOT NULL , + [notification_type_name] [varchar] (255) DEFAULT ('') NOT NULL , + [notification_type_enabled] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_notification_types] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_notification_types] PRIMARY KEY CLUSTERED + ( + [notification_type_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [type] ON [phpbb_notification_types]([notification_type_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_notifications' +*/ +CREATE TABLE [phpbb_notifications] ( + [notification_id] [int] IDENTITY (1, 1) NOT NULL , + [notification_type_id] [int] DEFAULT (0) NOT NULL , + [item_id] [int] DEFAULT (0) NOT NULL , + [item_parent_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notification_read] [int] DEFAULT (0) NOT NULL , + [notification_time] [int] DEFAULT (1) NOT NULL , + [notification_data] [varchar] (4000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_notifications] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_notifications] PRIMARY KEY CLUSTERED + ( + [notification_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [item_ident] ON [phpbb_notifications]([notification_type_id], [item_id]) ON [PRIMARY] +GO + +CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_oauth_accounts' +*/ +CREATE TABLE [phpbb_oauth_accounts] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [provider] [varchar] (255) DEFAULT ('') NOT NULL , + [oauth_provider_id] [varchar] (4000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_oauth_accounts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_oauth_accounts] PRIMARY KEY CLUSTERED + ( + [user_id], + [provider] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_oauth_tokens' +*/ +CREATE TABLE [phpbb_oauth_tokens] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [provider] [varchar] (255) DEFAULT ('') NOT NULL , + [oauth_token] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_oauth_tokens]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [provider] ON [phpbb_oauth_tokens]([provider]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE [phpbb_poll_options] ( + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , + [poll_option_total] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [poll_opt_id] ON [phpbb_poll_options]([poll_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_options]([topic_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE [phpbb_poll_votes] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [vote_user_id] [int] DEFAULT (0) NOT NULL , + [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_votes]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_id] ON [phpbb_poll_votes]([vote_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_ip] ON [phpbb_poll_votes]([vote_user_ip]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE [phpbb_posts] ( + [post_id] [int] IDENTITY (1, 1) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [poster_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [post_time] [int] DEFAULT (0) NOT NULL , + [post_visibility] [int] DEFAULT (0) NOT NULL , + [post_reported] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [post_username] [varchar] (255) DEFAULT ('') NOT NULL , + [post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [post_text] [text] DEFAULT ('') NOT NULL , + [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , + [post_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [post_postcount] [int] DEFAULT (1) NOT NULL , + [post_edit_time] [int] DEFAULT (0) NOT NULL , + [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [post_edit_user] [int] DEFAULT (0) NOT NULL , + [post_edit_count] [int] DEFAULT (0) NOT NULL , + [post_edit_locked] [int] DEFAULT (0) NOT NULL , + [post_delete_time] [int] DEFAULT (0) NOT NULL , + [post_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [post_delete_user] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED + ( + [post_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_posts]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_ip] ON [phpbb_posts]([poster_ip]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_visibility] ON [phpbb_posts]([post_visibility]) ON [PRIMARY] +GO + +CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] +GO + +CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE [phpbb_privmsgs] ( + [msg_id] [int] IDENTITY (1, 1) NOT NULL , + [root_level] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [author_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [message_time] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [message_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [message_text] [text] DEFAULT ('') NOT NULL , + [message_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [message_edit_user] [int] DEFAULT (0) NOT NULL , + [message_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [message_edit_time] [int] DEFAULT (0) NOT NULL , + [message_edit_count] [int] DEFAULT (0) NOT NULL , + [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [message_reported] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED + ( + [msg_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] +GO + +CREATE INDEX [message_time] ON [phpbb_privmsgs]([message_time]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [root_level] ON [phpbb_privmsgs]([root_level]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE TABLE [phpbb_privmsgs_folder] ( + [folder_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , + [pm_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED + ( + [folder_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE TABLE [phpbb_privmsgs_rules] ( + [rule_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [rule_check] [int] DEFAULT (0) NOT NULL , + [rule_connection] [int] DEFAULT (0) NOT NULL , + [rule_string] [varchar] (255) DEFAULT ('') NOT NULL , + [rule_user_id] [int] DEFAULT (0) NOT NULL , + [rule_group_id] [int] DEFAULT (0) NOT NULL , + [rule_action] [int] DEFAULT (0) NOT NULL , + [rule_folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED + ( + [rule_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE [phpbb_privmsgs_to] ( + [msg_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [pm_deleted] [int] DEFAULT (0) NOT NULL , + [pm_new] [int] DEFAULT (1) NOT NULL , + [pm_unread] [int] DEFAULT (1) NOT NULL , + [pm_replied] [int] DEFAULT (0) NOT NULL , + [pm_marked] [int] DEFAULT (0) NOT NULL , + [pm_forwarded] [int] DEFAULT (0) NOT NULL , + [folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [msg_id] ON [phpbb_privmsgs_to]([msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs_to]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [usr_flder_id] ON [phpbb_privmsgs_to]([user_id], [folder_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE [phpbb_profile_fields] ( + [field_id] [int] IDENTITY (1, 1) NOT NULL , + [field_name] [varchar] (255) DEFAULT ('') NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [field_ident] [varchar] (20) DEFAULT ('') NOT NULL , + [field_length] [varchar] (20) DEFAULT ('') NOT NULL , + [field_minlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_maxlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_novalue] [varchar] (255) DEFAULT ('') NOT NULL , + [field_default_value] [varchar] (255) DEFAULT ('') NOT NULL , + [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , + [field_required] [int] DEFAULT (0) NOT NULL , + [field_show_novalue] [int] DEFAULT (0) NOT NULL , + [field_show_on_reg] [int] DEFAULT (0) NOT NULL , + [field_show_on_pm] [int] DEFAULT (0) NOT NULL , + [field_show_on_vt] [int] DEFAULT (0) NOT NULL , + [field_show_profile] [int] DEFAULT (0) NOT NULL , + [field_hide] [int] DEFAULT (0) NOT NULL , + [field_no_view] [int] DEFAULT (0) NOT NULL , + [field_active] [int] DEFAULT (0) NOT NULL , + [field_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED + ( + [field_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] +GO + +CREATE INDEX [fld_ordr] ON [phpbb_profile_fields]([field_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE [phpbb_profile_fields_data] ( + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE [phpbb_profile_fields_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [option_id] [int] DEFAULT (0) NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [lang_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id], + [option_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE [phpbb_profile_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , + [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE [phpbb_ranks] ( + [rank_id] [int] IDENTITY (1, 1) NOT NULL , + [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , + [rank_min] [int] DEFAULT (0) NOT NULL , + [rank_special] [int] DEFAULT (0) NOT NULL , + [rank_image] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED + ( + [rank_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE [phpbb_reports] ( + [report_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [pm_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [report_closed] [int] DEFAULT (0) NOT NULL , + [report_time] [int] DEFAULT (0) NOT NULL , + [report_text] [text] DEFAULT ('') NOT NULL , + [reported_post_text] [text] DEFAULT ('') NOT NULL , + [reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [reported_post_enable_magic_url] [int] DEFAULT (1) NOT NULL , + [reported_post_enable_smilies] [int] DEFAULT (1) NOT NULL , + [reported_post_enable_bbcode] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED + ( + [report_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] +GO + +CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE [phpbb_reports_reasons] ( + [reason_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , + [reason_description] [text] DEFAULT ('') NOT NULL , + [reason_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED + ( + [reason_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE [phpbb_search_results] ( + [search_key] [varchar] (32) DEFAULT ('') NOT NULL , + [search_time] [int] DEFAULT (0) NOT NULL , + [search_keywords] [text] DEFAULT ('') NOT NULL , + [search_authors] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED + ( + [search_key] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE [phpbb_search_wordlist] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word_text] [varchar] (255) DEFAULT ('') NOT NULL , + [word_common] [int] DEFAULT (0) NOT NULL , + [word_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] +GO + +CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE [phpbb_search_wordmatch] ( + [post_id] [int] DEFAULT (0) NOT NULL , + [word_id] [int] DEFAULT (0) NOT NULL , + [title_match] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [unq_mtch] ON [phpbb_search_wordmatch]([word_id], [post_id], [title_match]) ON [PRIMARY] +GO + +CREATE INDEX [word_id] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE [phpbb_sessions] ( + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [session_user_id] [int] DEFAULT (0) NOT NULL , + [session_forum_id] [int] DEFAULT (0) NOT NULL , + [session_last_visit] [int] DEFAULT (0) NOT NULL , + [session_start] [int] DEFAULT (0) NOT NULL , + [session_time] [int] DEFAULT (0) NOT NULL , + [session_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [session_browser] [varchar] (150) DEFAULT ('') NOT NULL , + [session_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , + [session_page] [varchar] (255) DEFAULT ('') NOT NULL , + [session_viewonline] [int] DEFAULT (1) NOT NULL , + [session_autologin] [int] DEFAULT (0) NOT NULL , + [session_admin] [int] DEFAULT (0) NOT NULL , + [session_album_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED + ( + [session_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] +GO + +CREATE INDEX [session_user_id] ON [phpbb_sessions]([session_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [session_fid] ON [phpbb_sessions]([session_forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [session_aid] ON [phpbb_sessions]([session_album_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE [phpbb_sessions_keys] ( + [key_id] [char] (32) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [last_login] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED + ( + [key_id], + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sitelist' +*/ +CREATE TABLE [phpbb_sitelist] ( + [site_id] [int] IDENTITY (1, 1) NOT NULL , + [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , + [ip_exclude] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED + ( + [site_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE [phpbb_smilies] ( + [smiley_id] [int] IDENTITY (1, 1) NOT NULL , + [code] [varchar] (50) DEFAULT ('') NOT NULL , + [emotion] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_url] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_width] [int] DEFAULT (0) NOT NULL , + [smiley_height] [int] DEFAULT (0) NOT NULL , + [smiley_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED + ( + [smiley_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE [phpbb_styles] ( + [style_id] [int] IDENTITY (1, 1) NOT NULL , + [style_name] [varchar] (255) DEFAULT ('') NOT NULL , + [style_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [style_active] [int] DEFAULT (1) NOT NULL , + [style_path] [varchar] (100) DEFAULT ('') NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , + [style_parent_id] [int] DEFAULT (0) NOT NULL , + [style_parent_tree] [varchar] (8000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED + ( + [style_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_teampage' +*/ +CREATE TABLE [phpbb_teampage] ( + [teampage_id] [int] IDENTITY (1, 1) NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [teampage_name] [varchar] (255) DEFAULT ('') NOT NULL , + [teampage_position] [int] DEFAULT (0) NOT NULL , + [teampage_parent] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_teampage] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_teampage] PRIMARY KEY CLUSTERED + ( + [teampage_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE [phpbb_topics] ( + [topic_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [topic_attachment] [int] DEFAULT (0) NOT NULL , + [topic_visibility] [int] DEFAULT (0) NOT NULL , + [topic_reported] [int] DEFAULT (0) NOT NULL , + [topic_title] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_poster] [int] DEFAULT (0) NOT NULL , + [topic_time] [int] DEFAULT (0) NOT NULL , + [topic_time_limit] [int] DEFAULT (0) NOT NULL , + [topic_views] [int] DEFAULT (0) NOT NULL , + [topic_posts_approved] [int] DEFAULT (0) NOT NULL , + [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL , + [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL , + [topic_status] [int] DEFAULT (0) NOT NULL , + [topic_type] [int] DEFAULT (0) NOT NULL , + [topic_first_post_id] [int] DEFAULT (0) NOT NULL , + [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_post_time] [int] DEFAULT (0) NOT NULL , + [topic_last_view_time] [int] DEFAULT (0) NOT NULL , + [topic_moved_id] [int] DEFAULT (0) NOT NULL , + [topic_bumped] [int] DEFAULT (0) NOT NULL , + [topic_bumper] [int] DEFAULT (0) NOT NULL , + [poll_title] [varchar] (255) DEFAULT ('') NOT NULL , + [poll_start] [int] DEFAULT (0) NOT NULL , + [poll_length] [int] DEFAULT (0) NOT NULL , + [poll_max_options] [int] DEFAULT (1) NOT NULL , + [poll_last_vote] [int] DEFAULT (0) NOT NULL , + [poll_vote_change] [int] DEFAULT (0) NOT NULL , + [topic_delete_time] [int] DEFAULT (0) NOT NULL , + [topic_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_delete_user] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED + ( + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id_type] ON [phpbb_topics]([forum_id], [topic_type]) ON [PRIMARY] +GO + +CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY] +GO + +CREATE INDEX [topic_visibility] ON [phpbb_topics]([topic_visibility]) ON [PRIMARY] +GO + +CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_visibility], [topic_last_post_id]) ON [PRIMARY] +GO + +CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE [phpbb_topics_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_topics_track]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE [phpbb_topics_posted] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [topic_posted] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE [phpbb_topics_watch] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_topics_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE [phpbb_user_notifications] ( + [item_type] [varchar] (255) DEFAULT ('') NOT NULL , + [item_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [method] [varchar] (255) DEFAULT ('') NOT NULL , + [notify] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE [phpbb_user_group] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [group_leader] [int] DEFAULT (0) NOT NULL , + [user_pending] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_user_group]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_user_group]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [group_leader] ON [phpbb_user_group]([group_leader]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE [phpbb_users] ( + [user_id] [int] IDENTITY (1, 1) NOT NULL , + [user_type] [int] DEFAULT (0) NOT NULL , + [group_id] [int] DEFAULT (3) NOT NULL , + [user_permissions] [text] DEFAULT ('') NOT NULL , + [user_perm_from] [int] DEFAULT (0) NOT NULL , + [user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [user_regdate] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [username_clean] [varchar] (255) DEFAULT ('') NOT NULL , + [user_password] [varchar] (40) DEFAULT ('') NOT NULL , + [user_passchg] [int] DEFAULT (0) NOT NULL , + [user_pass_convert] [int] DEFAULT (0) NOT NULL , + [user_email] [varchar] (100) DEFAULT ('') NOT NULL , + [user_email_hash] [float] DEFAULT (0) NOT NULL , + [user_birthday] [varchar] (10) DEFAULT ('') NOT NULL , + [user_lastvisit] [int] DEFAULT (0) NOT NULL , + [user_lastmark] [int] DEFAULT (0) NOT NULL , + [user_lastpost_time] [int] DEFAULT (0) NOT NULL , + [user_lastpage] [varchar] (200) DEFAULT ('') NOT NULL , + [user_last_confirm_key] [varchar] (10) DEFAULT ('') NOT NULL , + [user_last_search] [int] DEFAULT (0) NOT NULL , + [user_warnings] [int] DEFAULT (0) NOT NULL , + [user_last_warning] [int] DEFAULT (0) NOT NULL , + [user_login_attempts] [int] DEFAULT (0) NOT NULL , + [user_inactive_reason] [int] DEFAULT (0) NOT NULL , + [user_inactive_time] [int] DEFAULT (0) NOT NULL , + [user_posts] [int] DEFAULT (0) NOT NULL , + [user_lang] [varchar] (30) DEFAULT ('') NOT NULL , + [user_timezone] [varchar] (100) DEFAULT ('UTC') NOT NULL , + [user_dateformat] [varchar] (30) DEFAULT ('d M Y H:i') NOT NULL , + [user_style] [int] DEFAULT (0) NOT NULL , + [user_rank] [int] DEFAULT (0) NOT NULL , + [user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [user_new_privmsg] [int] DEFAULT (0) NOT NULL , + [user_unread_privmsg] [int] DEFAULT (0) NOT NULL , + [user_last_privmsg] [int] DEFAULT (0) NOT NULL , + [user_message_rules] [int] DEFAULT (0) NOT NULL , + [user_full_folder] [int] DEFAULT (-3) NOT NULL , + [user_emailtime] [int] DEFAULT (0) NOT NULL , + [user_topic_show_days] [int] DEFAULT (0) NOT NULL , + [user_topic_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_topic_sortby_dir] [varchar] (1) DEFAULT ('d') NOT NULL , + [user_post_show_days] [int] DEFAULT (0) NOT NULL , + [user_post_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_post_sortby_dir] [varchar] (1) DEFAULT ('a') NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [user_notify_pm] [int] DEFAULT (1) NOT NULL , + [user_notify_type] [int] DEFAULT (0) NOT NULL , + [user_allow_pm] [int] DEFAULT (1) NOT NULL , + [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , + [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , + [user_allow_massemail] [int] DEFAULT (1) NOT NULL , + [user_options] [int] DEFAULT (230271) NOT NULL , + [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [user_avatar_type] [varchar] (255) DEFAULT ('') NOT NULL , + [user_avatar_width] [int] DEFAULT (0) NOT NULL , + [user_avatar_height] [int] DEFAULT (0) NOT NULL , + [user_sig] [text] DEFAULT ('') NOT NULL , + [user_sig_bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [user_sig_bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [user_from] [varchar] (100) DEFAULT ('') NOT NULL , + [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , + [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_yim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_msnm] [varchar] (255) DEFAULT ('') NOT NULL , + [user_jabber] [varchar] (255) DEFAULT ('') NOT NULL , + [user_website] [varchar] (200) DEFAULT ('') NOT NULL , + [user_occ] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , + [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , + [user_new] [int] DEFAULT (1) NOT NULL , + [user_reminded] [int] DEFAULT (0) NOT NULL , + [user_reminded_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] +GO + +CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] +GO + +CREATE INDEX [user_type] ON [phpbb_users]([user_type]) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [username_clean] ON [phpbb_users]([username_clean]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE [phpbb_warnings] ( + [warning_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [log_id] [int] DEFAULT (0) NOT NULL , + [warning_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED + ( + [warning_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE [phpbb_words] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word] [varchar] (255) DEFAULT ('') NOT NULL , + [replacement] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE [phpbb_zebra] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [zebra_id] [int] DEFAULT (0) NOT NULL , + [friend] [int] DEFAULT (0) NOT NULL , + [foe] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED + ( + [user_id], + [zebra_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_albums' +*/ +CREATE TABLE [phpbb_gallery_albums] ( + [album_id] [int] IDENTITY (1, 1) NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (1) NOT NULL , + [right_id] [int] DEFAULT (2) NOT NULL , + [album_parents] [text] DEFAULT ('') NOT NULL , + [album_type] [int] DEFAULT (1) NOT NULL , + [album_status] [int] DEFAULT (1) NOT NULL , + [album_contest] [int] DEFAULT (0) NOT NULL , + [album_name] [varchar] (255) DEFAULT ('') NOT NULL , + [album_desc] [text] DEFAULT ('') NOT NULL , + [album_desc_options] [int] DEFAULT (7) NOT NULL , + [album_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [album_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [album_user_id] [int] DEFAULT (0) NOT NULL , + [album_images] [int] DEFAULT (0) NOT NULL , + [album_images_real] [int] DEFAULT (0) NOT NULL , + [album_last_image_id] [int] DEFAULT (0) NOT NULL , + [album_image] [varchar] (255) DEFAULT ('') NOT NULL , + [album_last_image_time] [int] DEFAULT (0) NOT NULL , + [album_last_image_name] [varchar] (255) DEFAULT ('') NOT NULL , + [album_last_username] [varchar] (255) DEFAULT ('') NOT NULL , + [album_last_user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [album_last_user_id] [int] DEFAULT (0) NOT NULL , + [album_watermark] [int] DEFAULT (1) NOT NULL , + [album_sort_key] [varchar] (8) DEFAULT ('') NOT NULL , + [album_sort_dir] [varchar] (8) DEFAULT ('') NOT NULL , + [display_in_rrc] [int] DEFAULT (1) NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL , + [display_subalbum_list] [int] DEFAULT (1) NOT NULL , + [album_feed] [int] DEFAULT (1) NOT NULL , + [album_auth_access] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_albums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_albums] PRIMARY KEY CLUSTERED + ( + [album_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_albums_track' +*/ +CREATE TABLE [phpbb_gallery_albums_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [album_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_albums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_albums_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [album_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_comments' +*/ +CREATE TABLE [phpbb_gallery_comments] ( + [comment_id] [int] IDENTITY (1, 1) NOT NULL , + [comment_image_id] [int] NOT NULL , + [comment_user_id] [int] DEFAULT (0) NOT NULL , + [comment_username] [varchar] (255) DEFAULT ('') NOT NULL , + [comment_user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [comment_user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [comment_signature] [int] DEFAULT (0) NOT NULL , + [comment_time] [int] DEFAULT (0) NOT NULL , + [comment] [text] DEFAULT ('') NOT NULL , + [comment_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [comment_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [comment_edit_time] [int] DEFAULT (0) NOT NULL , + [comment_edit_count] [int] DEFAULT (0) NOT NULL , + [comment_edit_user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_comments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_comments] PRIMARY KEY CLUSTERED + ( + [comment_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [id] ON [phpbb_gallery_comments]([comment_image_id]) ON [PRIMARY] +GO + +CREATE INDEX [uid] ON [phpbb_gallery_comments]([comment_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [ip] ON [phpbb_gallery_comments]([comment_user_ip]) ON [PRIMARY] +GO + +CREATE INDEX [time] ON [phpbb_gallery_comments]([comment_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_contests' +*/ +CREATE TABLE [phpbb_gallery_contests] ( + [contest_id] [int] IDENTITY (1, 1) NOT NULL , + [contest_album_id] [int] DEFAULT (0) NOT NULL , + [contest_start] [int] DEFAULT (0) NOT NULL , + [contest_rating] [int] DEFAULT (0) NOT NULL , + [contest_end] [int] DEFAULT (0) NOT NULL , + [contest_marked] [int] DEFAULT (0) NOT NULL , + [contest_first] [int] DEFAULT (0) NOT NULL , + [contest_second] [int] DEFAULT (0) NOT NULL , + [contest_third] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_contests] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_contests] PRIMARY KEY CLUSTERED + ( + [contest_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_favorites' +*/ +CREATE TABLE [phpbb_gallery_favorites] ( + [favorite_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [image_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_favorites] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_favorites] PRIMARY KEY CLUSTERED + ( + [favorite_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [uid] ON [phpbb_gallery_favorites]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [id] ON [phpbb_gallery_favorites]([image_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_images' +*/ +CREATE TABLE [phpbb_gallery_images] ( + [image_id] [int] IDENTITY (1, 1) NOT NULL , + [image_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [image_name] [varchar] (255) DEFAULT ('') NOT NULL , + [image_name_clean] [varchar] (255) DEFAULT ('') NOT NULL , + [image_desc] [text] DEFAULT ('') NOT NULL , + [image_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [image_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [image_user_id] [int] DEFAULT (0) NOT NULL , + [image_username] [varchar] (255) DEFAULT ('') NOT NULL , + [image_username_clean] [varchar] (255) DEFAULT ('') NOT NULL , + [image_user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [image_user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [image_time] [int] DEFAULT (0) NOT NULL , + [image_album_id] [int] DEFAULT (0) NOT NULL , + [image_view_count] [int] DEFAULT (0) NOT NULL , + [image_status] [int] DEFAULT (0) NOT NULL , + [image_contest] [int] DEFAULT (0) NOT NULL , + [image_contest_end] [int] DEFAULT (0) NOT NULL , + [image_contest_rank] [int] DEFAULT (0) NOT NULL , + [image_filemissing] [int] DEFAULT (0) NOT NULL , + [image_has_exif] [int] DEFAULT (2) NOT NULL , + [image_exif_data] [varchar] (8000) DEFAULT ('') NOT NULL , + [image_rates] [int] DEFAULT (0) NOT NULL , + [image_rate_points] [int] DEFAULT (0) NOT NULL , + [image_rate_avg] [int] DEFAULT (0) NOT NULL , + [image_comments] [int] DEFAULT (0) NOT NULL , + [image_last_comment] [int] DEFAULT (0) NOT NULL , + [image_allow_comments] [int] DEFAULT (1) NOT NULL , + [image_favorited] [int] DEFAULT (0) NOT NULL , + [image_reported] [int] DEFAULT (0) NOT NULL , + [filesize_upload] [int] DEFAULT (0) NOT NULL , + [filesize_medium] [int] DEFAULT (0) NOT NULL , + [filesize_cache] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_images] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_images] PRIMARY KEY CLUSTERED + ( + [image_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [aid] ON [phpbb_gallery_images]([image_album_id]) ON [PRIMARY] +GO + +CREATE INDEX [uid] ON [phpbb_gallery_images]([image_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [time] ON [phpbb_gallery_images]([image_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_modscache' +*/ +CREATE TABLE [phpbb_gallery_modscache] ( + [album_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [doi] ON [phpbb_gallery_modscache]([display_on_index]) ON [PRIMARY] +GO + +CREATE INDEX [aid] ON [phpbb_gallery_modscache]([album_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_permissions' +*/ +CREATE TABLE [phpbb_gallery_permissions] ( + [perm_id] [int] IDENTITY (1, 1) NOT NULL , + [perm_role_id] [int] DEFAULT (0) NOT NULL , + [perm_album_id] [int] DEFAULT (0) NOT NULL , + [perm_user_id] [int] DEFAULT (0) NOT NULL , + [perm_group_id] [int] DEFAULT (0) NOT NULL , + [perm_system] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_permissions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_permissions] PRIMARY KEY CLUSTERED + ( + [perm_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_rates' +*/ +CREATE TABLE [phpbb_gallery_rates] ( + [rate_image_id] [int] DEFAULT (0) NOT NULL , + [rate_user_id] [int] DEFAULT (0) NOT NULL , + [rate_user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [rate_point] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_rates] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_rates] PRIMARY KEY CLUSTERED + ( + [rate_image_id], + [rate_user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_reports' +*/ +CREATE TABLE [phpbb_gallery_reports] ( + [report_id] [int] IDENTITY (1, 1) NOT NULL , + [report_album_id] [int] DEFAULT (0) NOT NULL , + [report_image_id] [int] DEFAULT (0) NOT NULL , + [reporter_id] [int] DEFAULT (0) NOT NULL , + [report_manager] [int] DEFAULT (0) NOT NULL , + [report_note] [text] DEFAULT ('') NOT NULL , + [report_time] [int] DEFAULT (0) NOT NULL , + [report_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_reports] PRIMARY KEY CLUSTERED + ( + [report_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_roles' +*/ +CREATE TABLE [phpbb_gallery_roles] ( + [role_id] [int] IDENTITY (1, 1) NOT NULL , + [a_list] [int] DEFAULT (0) NOT NULL , + [i_view] [int] DEFAULT (0) NOT NULL , + [i_watermark] [int] DEFAULT (0) NOT NULL , + [i_upload] [int] DEFAULT (0) NOT NULL , + [i_edit] [int] DEFAULT (0) NOT NULL , + [i_delete] [int] DEFAULT (0) NOT NULL , + [i_rate] [int] DEFAULT (0) NOT NULL , + [i_approve] [int] DEFAULT (0) NOT NULL , + [i_lock] [int] DEFAULT (0) NOT NULL , + [i_report] [int] DEFAULT (0) NOT NULL , + [i_count] [int] DEFAULT (0) NOT NULL , + [i_unlimited] [int] DEFAULT (0) NOT NULL , + [c_read] [int] DEFAULT (0) NOT NULL , + [c_post] [int] DEFAULT (0) NOT NULL , + [c_edit] [int] DEFAULT (0) NOT NULL , + [c_delete] [int] DEFAULT (0) NOT NULL , + [m_comments] [int] DEFAULT (0) NOT NULL , + [m_delete] [int] DEFAULT (0) NOT NULL , + [m_edit] [int] DEFAULT (0) NOT NULL , + [m_move] [int] DEFAULT (0) NOT NULL , + [m_report] [int] DEFAULT (0) NOT NULL , + [m_status] [int] DEFAULT (0) NOT NULL , + [a_count] [int] DEFAULT (0) NOT NULL , + [a_unlimited] [int] DEFAULT (0) NOT NULL , + [a_restrict] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_roles] PRIMARY KEY CLUSTERED + ( + [role_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_users' +*/ +CREATE TABLE [phpbb_gallery_users] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [watch_own] [int] DEFAULT (0) NOT NULL , + [watch_favo] [int] DEFAULT (0) NOT NULL , + [watch_com] [int] DEFAULT (0) NOT NULL , + [user_images] [int] DEFAULT (0) NOT NULL , + [personal_album_id] [int] DEFAULT (0) NOT NULL , + [user_lastmark] [int] DEFAULT (0) NOT NULL , + [user_last_update] [int] DEFAULT (0) NOT NULL , + [user_viewexif] [int] DEFAULT (0) NOT NULL , + [user_permissions] [text] DEFAULT ('') NOT NULL , + [user_permissions_changed] [int] DEFAULT (0) NOT NULL , + [user_allow_comments] [int] DEFAULT (1) NOT NULL , + [subscribe_pegas] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_users] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [pega] ON [phpbb_gallery_users]([personal_album_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_gallery_watch' +*/ +CREATE TABLE [phpbb_gallery_watch] ( + [watch_id] [int] IDENTITY (1, 1) NOT NULL , + [album_id] [int] DEFAULT (0) NOT NULL , + [image_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_gallery_watch] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_gallery_watch] PRIMARY KEY CLUSTERED + ( + [watch_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [uid] ON [phpbb_gallery_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [id] ON [phpbb_gallery_watch]([image_id]) ON [PRIMARY] +GO + +CREATE INDEX [aid] ON [phpbb_gallery_watch]([album_id]) ON [PRIMARY] +GO + + diff --git a/tests/schemas/mysql_40_schema.sql b/tests/schemas/mysql_40_schema.sql new file mode 100644 index 00000000..f34386c7 --- /dev/null +++ b/tests/schemas/mysql_40_schema.sql @@ -0,0 +1,1336 @@ +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + physical_filename varbinary(255) DEFAULT '' NOT NULL, + real_filename varbinary(255) DEFAULT '' NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_comment blob NOT NULL, + extension varbinary(100) DEFAULT '' NOT NULL, + mimetype varbinary(100) DEFAULT '' NOT NULL, + filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, + thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id), + KEY filetime (filetime), + KEY post_msg_id (post_msg_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY is_orphan (is_orphan) +); + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY group_id (group_id), + KEY auth_opt_id (auth_option_id), + KEY auth_role_id (auth_role_id) +); + + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, + auth_option varbinary(50) DEFAULT '' NOT NULL, + is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + UNIQUE auth_option (auth_option) +); + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + role_name blob NOT NULL, + role_description blob NOT NULL, + role_type varbinary(10) DEFAULT '' NOT NULL, + role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id), + KEY role_type (role_type), + KEY role_order (role_order) +); + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id), + KEY ath_op_id (auth_option_id) +); + + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY user_id (user_id), + KEY auth_option_id (auth_option_id), + KEY auth_role_id (auth_role_id) +); + + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + ban_ip varbinary(40) DEFAULT '' NOT NULL, + ban_email blob NOT NULL, + ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ban_reason blob NOT NULL, + ban_give_reason blob NOT NULL, + PRIMARY KEY (ban_id), + KEY ban_end (ban_end), + KEY ban_user (ban_userid, ban_exclude), + KEY ban_email (ban_email(255), ban_exclude), + KEY ban_ip (ban_ip, ban_exclude) +); + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_tag varbinary(16) DEFAULT '' NOT NULL, + bbcode_helpline blob NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_match blob NOT NULL, + bbcode_tpl mediumblob NOT NULL, + first_pass_match mediumblob NOT NULL, + first_pass_replace mediumblob NOT NULL, + second_pass_match mediumblob NOT NULL, + second_pass_replace mediumblob NOT NULL, + PRIMARY KEY (bbcode_id), + KEY display_on_post (display_on_posting) +); + + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id, user_id) +); + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, + bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + bot_name blob NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bot_agent varbinary(255) DEFAULT '' NOT NULL, + bot_ip varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id), + KEY bot_active (bot_active) +); + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varbinary(255) DEFAULT '' NOT NULL, + config_value blob NOT NULL, + is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +); + + +# Table: 'phpbb_config_text' +CREATE TABLE phpbb_config_text ( + config_name varbinary(255) DEFAULT '' NOT NULL, + config_value mediumblob NOT NULL, + PRIMARY KEY (config_name) +); + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id binary(32) DEFAULT '' NOT NULL, + session_id binary(32) DEFAULT '' NOT NULL, + confirm_type tinyint(3) DEFAULT '0' NOT NULL, + code varbinary(8) DEFAULT '' NOT NULL, + seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id, confirm_id), + KEY confirm_type (confirm_type) +); + + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username blob NOT NULL, + PRIMARY KEY (disallow_id) +); + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + draft_subject blob NOT NULL, + draft_message mediumblob NOT NULL, + PRIMARY KEY (draft_id), + KEY save_time (save_time) +); + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varbinary(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state blob NOT NULL, + UNIQUE ext_name (ext_name) +); + + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + extension varbinary(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +); + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_name blob NOT NULL, + cat_id tinyint(2) DEFAULT '0' NOT NULL, + allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + upload_icon varbinary(255) DEFAULT '' NOT NULL, + max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + allowed_forums blob NOT NULL, + allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id) +); + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_parents mediumblob NOT NULL, + forum_name blob NOT NULL, + forum_desc blob NOT NULL, + forum_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_desc_uid varbinary(8) DEFAULT '' NOT NULL, + forum_link blob NOT NULL, + forum_password varbinary(120) DEFAULT '' NOT NULL, + forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_image varbinary(255) DEFAULT '' NOT NULL, + forum_rules blob NOT NULL, + forum_rules_link blob NOT NULL, + forum_rules_bitfield varbinary(255) DEFAULT '' NOT NULL, + forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_rules_uid varbinary(8) DEFAULT '' NOT NULL, + forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, + forum_type tinyint(4) DEFAULT '0' NOT NULL, + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject blob NOT NULL, + forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_name blob NOT NULL, + forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, + forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, + display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, + prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_right_id (left_id, right_id), + KEY forum_lastpost_id (forum_last_post_id) +); + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id binary(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +); + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, forum_id) +); + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +); + + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_name blob NOT NULL, + group_desc blob NOT NULL, + group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + group_desc_uid varbinary(8) DEFAULT '' NOT NULL, + group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar varbinary(255) DEFAULT '' NOT NULL, + group_avatar_type varbinary(255) DEFAULT '' NOT NULL, + group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_colour varbinary(6) DEFAULT '' NOT NULL, + group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id), + KEY group_legend_name (group_legend, group_name(255)) +); + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, + icons_url varbinary(255) DEFAULT '' NOT NULL, + icons_width tinyint(4) DEFAULT '0' NOT NULL, + icons_height tinyint(4) DEFAULT '0' NOT NULL, + icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (icons_id), + KEY display_on_posting (display_on_posting) +); + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id tinyint(4) NOT NULL auto_increment, + lang_iso varbinary(30) DEFAULT '' NOT NULL, + lang_dir varbinary(30) DEFAULT '' NOT NULL, + lang_english_name blob NOT NULL, + lang_local_name blob NOT NULL, + lang_author blob NOT NULL, + PRIMARY KEY (lang_id), + KEY lang_iso (lang_iso) +); + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id mediumint(8) UNSIGNED NOT NULL auto_increment, + log_type tinyint(4) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_ip varbinary(40) DEFAULT '' NOT NULL, + log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + log_operation blob NOT NULL, + log_data mediumblob NOT NULL, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (log_id), + KEY log_type (log_type), + KEY log_time (log_time), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY reportee_id (reportee_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varbinary(40) DEFAULT '' NOT NULL, + attempt_browser varbinary(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL, + attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + username_clean blob NOT NULL, + KEY att_ip (attempt_ip, attempt_time), + KEY att_for (attempt_forwarded_for, attempt_time), + KEY att_time (attempt_time), + KEY user_id (user_id) +); + + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name blob NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY disp_idx (display_on_index), + KEY forum_id (forum_id) +); + + +# Table: 'phpbb_migrations' +CREATE TABLE phpbb_migrations ( + migration_name varbinary(255) DEFAULT '' NOT NULL, + migration_depends_on blob NOT NULL, + migration_schema_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + migration_data_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + migration_data_state blob NOT NULL, + migration_start_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + migration_end_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (migration_name) +); + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id mediumint(8) UNSIGNED NOT NULL auto_increment, + module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_basename varbinary(255) DEFAULT '' NOT NULL, + module_class varbinary(10) DEFAULT '' NOT NULL, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + module_langname varbinary(255) DEFAULT '' NOT NULL, + module_mode varbinary(255) DEFAULT '' NOT NULL, + module_auth varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id), + KEY left_right_id (left_id, right_id), + KEY module_enabled (module_enabled), + KEY class_left_id (module_class, left_id) +); + + +# Table: 'phpbb_notification_types' +CREATE TABLE phpbb_notification_types ( + notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment, + notification_type_name varbinary(255) DEFAULT '' NOT NULL, + notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (notification_type_id), + UNIQUE type (notification_type_name) +); + + +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id int(10) UNSIGNED NOT NULL auto_increment, + notification_type_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL, + notification_data blob NOT NULL, + PRIMARY KEY (notification_id), + KEY item_ident (notification_type_id, item_id), + KEY user (user_id, notification_read) +); + + +# Table: 'phpbb_oauth_accounts' +CREATE TABLE phpbb_oauth_accounts ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + provider varbinary(255) DEFAULT '' NOT NULL, + oauth_provider_id blob NOT NULL, + PRIMARY KEY (user_id, provider) +); + + +# Table: 'phpbb_oauth_tokens' +CREATE TABLE phpbb_oauth_tokens ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id binary(32) DEFAULT '' NOT NULL, + provider varbinary(255) DEFAULT '' NOT NULL, + oauth_token mediumblob NOT NULL, + KEY user_id (user_id), + KEY provider (provider) +); + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_text blob NOT NULL, + poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + KEY poll_opt_id (poll_option_id), + KEY topic_id (topic_id) +); + + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + vote_user_ip varbinary(40) DEFAULT '' NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +); + + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varbinary(40) DEFAULT '' NOT NULL, + post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_visibility tinyint(3) DEFAULT '0' NOT NULL, + post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_username blob NOT NULL, + post_subject blob NOT NULL, + post_text mediumblob NOT NULL, + post_checksum varbinary(32) DEFAULT '' NOT NULL, + post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_reason blob NOT NULL, + post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_delete_reason blob NOT NULL, + post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_ip (poster_ip), + KEY poster_id (poster_id), + KEY post_visibility (post_visibility), + KEY post_username (post_username(255)), + KEY tid_post_time (topic_id, post_time) +); + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, + root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_ip varbinary(40) DEFAULT '' NOT NULL, + message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + message_subject blob NOT NULL, + message_text mediumblob NOT NULL, + message_edit_reason blob NOT NULL, + message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + to_address blob NOT NULL, + bcc_address blob NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (msg_id), + KEY author_ip (author_ip), + KEY message_time (message_time), + KEY author_id (author_id), + KEY root_level (root_level) +); + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + folder_name blob NOT NULL, + pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (folder_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_string blob NOT NULL, + rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_folder_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + folder_id int(11) DEFAULT '0' NOT NULL, + KEY msg_id (msg_id), + KEY author_id (author_id), + KEY usr_flder_id (user_id, folder_id) +); + + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id mediumint(8) UNSIGNED NOT NULL auto_increment, + field_name blob NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + field_ident varbinary(20) DEFAULT '' NOT NULL, + field_length varbinary(20) DEFAULT '' NOT NULL, + field_minlen varbinary(255) DEFAULT '' NOT NULL, + field_maxlen varbinary(255) DEFAULT '' NOT NULL, + field_novalue blob NOT NULL, + field_default_value blob NOT NULL, + field_validation varbinary(60) DEFAULT '' NOT NULL, + field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (field_id), + KEY fld_type (field_type), + KEY fld_ordr (field_order) +); + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +); + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + lang_value blob NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +); + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_name blob NOT NULL, + lang_explain blob NOT NULL, + lang_default_value blob NOT NULL, + PRIMARY KEY (field_id, lang_id) +); + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, + rank_title blob NOT NULL, + rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + rank_image varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +); + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_text mediumblob NOT NULL, + reported_post_text mediumblob NOT NULL, + reported_post_uid varbinary(8) DEFAULT '' NOT NULL, + reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL, + reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) +); + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint(4) UNSIGNED NOT NULL auto_increment, + reason_title blob NOT NULL, + reason_description mediumblob NOT NULL, + reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (reason_id) +); + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varbinary(32) DEFAULT '' NOT NULL, + search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + search_keywords mediumblob NOT NULL, + search_authors mediumblob NOT NULL, + PRIMARY KEY (search_key) +); + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_text blob NOT NULL, + word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (word_id), + UNIQUE wrd_txt (word_text(255)), + KEY wrd_cnt (word_count) +); + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE unq_mtch (word_id, post_id, title_match), + KEY word_id (word_id), + KEY post_id (post_id) +); + + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id binary(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_ip varbinary(40) DEFAULT '' NOT NULL, + session_browser varbinary(150) DEFAULT '' NOT NULL, + session_forwarded_for varbinary(255) DEFAULT '' NOT NULL, + session_page blob NOT NULL, + session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time), + KEY session_user_id (session_user_id), + KEY session_fid (session_forum_id), + KEY session_aid (session_album_id) +); + + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id binary(32) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + last_ip varbinary(40) DEFAULT '' NOT NULL, + last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (key_id, user_id), + KEY last_login (last_login) +); + + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id mediumint(8) UNSIGNED NOT NULL auto_increment, + site_ip varbinary(40) DEFAULT '' NOT NULL, + site_hostname varbinary(255) DEFAULT '' NOT NULL, + ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (site_id) +); + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, + code varbinary(150) DEFAULT '' NOT NULL, + emotion varbinary(150) DEFAULT '' NOT NULL, + smiley_url varbinary(50) DEFAULT '' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smiley_id), + KEY display_on_post (display_on_posting) +); + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id mediumint(8) UNSIGNED NOT NULL auto_increment, + style_name blob NOT NULL, + style_copyright blob NOT NULL, + style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + style_path varbinary(100) DEFAULT '' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, + style_parent_tree blob NOT NULL, + PRIMARY KEY (style_id), + UNIQUE style_name (style_name(255)) +); + + +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_name blob NOT NULL, + teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (teampage_id) +); + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_visibility tinyint(3) DEFAULT '0' NOT NULL, + topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_title blob NOT NULL, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name blob NOT NULL, + topic_first_poster_colour varbinary(6) DEFAULT '' NOT NULL, + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name blob NOT NULL, + topic_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, + topic_last_post_subject blob NOT NULL, + topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title blob NOT NULL, + poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_max_options tinyint(4) DEFAULT '1' NOT NULL, + poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_delete_reason blob NOT NULL, + topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY forum_id_type (forum_id, topic_type), + KEY last_post_time (topic_last_post_time), + KEY topic_visibility (topic_visibility), + KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id), + KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) +); + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id), + KEY topic_id (topic_id), + KEY forum_id (forum_id) +); + + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id) +); + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +); + + +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varbinary(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + method varbinary(255) DEFAULT '' NOT NULL, + notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL +); + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY group_id (group_id), + KEY user_id (user_id), + KEY group_leader (group_leader) +); + + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_type tinyint(2) DEFAULT '0' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, + user_permissions mediumblob NOT NULL, + user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_ip varbinary(40) DEFAULT '' NOT NULL, + user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + username_clean blob NOT NULL, + user_password varbinary(120) DEFAULT '' NOT NULL, + user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_email blob NOT NULL, + user_email_hash bigint(20) DEFAULT '0' NOT NULL, + user_birthday varbinary(10) DEFAULT '' NOT NULL, + user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpage blob NOT NULL, + user_last_confirm_key varbinary(10) DEFAULT '' NOT NULL, + user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_warnings tinyint(4) DEFAULT '0' NOT NULL, + user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, + user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, + user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varbinary(30) DEFAULT '' NOT NULL, + user_timezone varbinary(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varbinary(90) DEFAULT 'd M Y H:i' NOT NULL, + user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_colour varbinary(6) DEFAULT '' NOT NULL, + user_new_privmsg int(4) DEFAULT '0' NOT NULL, + user_unread_privmsg int(4) DEFAULT '0' NOT NULL, + user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_full_folder int(11) DEFAULT '-3' NOT NULL, + user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_sortby_type varbinary(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varbinary(1) DEFAULT 'd' NOT NULL, + user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_post_sortby_type varbinary(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varbinary(1) DEFAULT 'a' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_notify_type tinyint(4) DEFAULT '0' NOT NULL, + user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, + user_avatar varbinary(255) DEFAULT '' NOT NULL, + user_avatar_type varbinary(255) DEFAULT '' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_sig mediumblob NOT NULL, + user_sig_bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + user_from blob NOT NULL, + user_icq varbinary(15) DEFAULT '' NOT NULL, + user_aim blob NOT NULL, + user_yim blob NOT NULL, + user_msnm blob NOT NULL, + user_jabber blob NOT NULL, + user_website blob NOT NULL, + user_occ blob NOT NULL, + user_interests blob NOT NULL, + user_actkey varbinary(32) DEFAULT '' NOT NULL, + user_newpasswd varbinary(120) DEFAULT '' NOT NULL, + user_form_salt varbinary(96) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY user_birthday (user_birthday), + KEY user_email_hash (user_email_hash), + KEY user_type (user_type), + UNIQUE username_clean (username_clean(255)) +); + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +); + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word blob NOT NULL, + replacement blob NOT NULL, + PRIMARY KEY (word_id) +); + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, zebra_id) +); + + +# Table: 'phpbb_gallery_albums' +CREATE TABLE phpbb_gallery_albums ( + album_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '1' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '2' NOT NULL, + album_parents mediumblob NOT NULL, + album_type int(3) UNSIGNED DEFAULT '1' NOT NULL, + album_status int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_contest mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_name varbinary(255) DEFAULT '' NOT NULL, + album_desc mediumblob NOT NULL, + album_desc_options int(3) UNSIGNED DEFAULT '7' NOT NULL, + album_desc_uid varbinary(8) DEFAULT '' NOT NULL, + album_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + album_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_images mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_images_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_last_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_image varbinary(255) DEFAULT '' NOT NULL, + album_last_image_time int(11) DEFAULT '0' NOT NULL, + album_last_image_name varbinary(255) DEFAULT '' NOT NULL, + album_last_username varbinary(255) DEFAULT '' NOT NULL, + album_last_user_colour varbinary(6) DEFAULT '' NOT NULL, + album_last_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_watermark int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_sort_key varbinary(8) DEFAULT '' NOT NULL, + album_sort_dir varbinary(8) DEFAULT '' NOT NULL, + display_in_rrc int(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index int(1) UNSIGNED DEFAULT '1' NOT NULL, + display_subalbum_list int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_feed tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + album_auth_access tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (album_id) +); + + +# Table: 'phpbb_gallery_albums_track' +CREATE TABLE phpbb_gallery_albums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, album_id) +); + + +# Table: 'phpbb_gallery_comments' +CREATE TABLE phpbb_gallery_comments ( + comment_id mediumint(8) UNSIGNED NOT NULL auto_increment, + comment_image_id mediumint(8) UNSIGNED NOT NULL, + comment_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + comment_username varbinary(255) DEFAULT '' NOT NULL, + comment_user_colour varbinary(6) DEFAULT '' NOT NULL, + comment_user_ip varbinary(40) DEFAULT '' NOT NULL, + comment_signature tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + comment_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + comment mediumblob NOT NULL, + comment_uid varbinary(8) DEFAULT '' NOT NULL, + comment_bitfield varbinary(255) DEFAULT '' NOT NULL, + comment_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + comment_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + comment_edit_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (comment_id), + KEY id (comment_image_id), + KEY uid (comment_user_id), + KEY ip (comment_user_ip), + KEY time (comment_time) +); + + +# Table: 'phpbb_gallery_contests' +CREATE TABLE phpbb_gallery_contests ( + contest_id mediumint(8) UNSIGNED NOT NULL auto_increment, + contest_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_rating int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_marked tinyint(1) DEFAULT '0' NOT NULL, + contest_first mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_second mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_third mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (contest_id) +); + + +# Table: 'phpbb_gallery_favorites' +CREATE TABLE phpbb_gallery_favorites ( + favorite_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (favorite_id), + KEY uid (user_id), + KEY id (image_id) +); + + +# Table: 'phpbb_gallery_images' +CREATE TABLE phpbb_gallery_images ( + image_id mediumint(8) UNSIGNED NOT NULL auto_increment, + image_filename varbinary(255) DEFAULT '' NOT NULL, + image_name varbinary(255) DEFAULT '' NOT NULL, + image_name_clean varbinary(255) DEFAULT '' NOT NULL, + image_desc mediumblob NOT NULL, + image_desc_uid varbinary(8) DEFAULT '' NOT NULL, + image_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + image_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_username varbinary(255) DEFAULT '' NOT NULL, + image_username_clean varbinary(255) DEFAULT '' NOT NULL, + image_user_colour varbinary(6) DEFAULT '' NOT NULL, + image_user_ip varbinary(40) DEFAULT '' NOT NULL, + image_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_view_count int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_contest int(1) UNSIGNED DEFAULT '0' NOT NULL, + image_contest_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_contest_rank int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_filemissing int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_has_exif int(3) UNSIGNED DEFAULT '2' NOT NULL, + image_exif_data blob NOT NULL, + image_rates mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_rate_points mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_rate_avg mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_comments mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_last_comment mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_allow_comments tinyint(1) DEFAULT '1' NOT NULL, + image_favorited mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_reported mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + filesize_upload int(20) UNSIGNED DEFAULT '0' NOT NULL, + filesize_medium int(20) UNSIGNED DEFAULT '0' NOT NULL, + filesize_cache int(20) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (image_id), + KEY aid (image_album_id), + KEY uid (image_user_id), + KEY time (image_time) +); + + +# Table: 'phpbb_gallery_modscache' +CREATE TABLE phpbb_gallery_modscache ( + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varbinary(255) DEFAULT '' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name varbinary(255) DEFAULT '' NOT NULL, + display_on_index tinyint(1) DEFAULT '1' NOT NULL, + KEY doi (display_on_index), + KEY aid (album_id) +); + + +# Table: 'phpbb_gallery_permissions' +CREATE TABLE phpbb_gallery_permissions ( + perm_id mediumint(8) UNSIGNED NOT NULL auto_increment, + perm_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_system int(3) DEFAULT '0' NOT NULL, + PRIMARY KEY (perm_id) +); + + +# Table: 'phpbb_gallery_rates' +CREATE TABLE phpbb_gallery_rates ( + rate_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rate_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rate_user_ip varbinary(40) DEFAULT '' NOT NULL, + rate_point int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (rate_image_id, rate_user_id) +); + + +# Table: 'phpbb_gallery_reports' +CREATE TABLE phpbb_gallery_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + report_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reporter_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_manager mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_note mediumblob NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (report_id) +); + + +# Table: 'phpbb_gallery_roles' +CREATE TABLE phpbb_gallery_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + a_list int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_view int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_watermark int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_upload int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_rate int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_approve int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_lock int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_report int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + i_unlimited int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_read int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_post int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_comments int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_move int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_report int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + a_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + a_unlimited int(3) UNSIGNED DEFAULT '0' NOT NULL, + a_restrict int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id) +); + + +# Table: 'phpbb_gallery_users' +CREATE TABLE phpbb_gallery_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + watch_own int(3) UNSIGNED DEFAULT '0' NOT NULL, + watch_favo int(3) UNSIGNED DEFAULT '0' NOT NULL, + watch_com int(3) UNSIGNED DEFAULT '0' NOT NULL, + user_images mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + personal_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_last_update int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_viewexif int(1) UNSIGNED DEFAULT '0' NOT NULL, + user_permissions mediumblob NOT NULL, + user_permissions_changed int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_allow_comments tinyint(1) DEFAULT '1' NOT NULL, + subscribe_pegas tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY pega (personal_album_id) +); + + +# Table: 'phpbb_gallery_watch' +CREATE TABLE phpbb_gallery_watch ( + watch_id mediumint(8) UNSIGNED NOT NULL auto_increment, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (watch_id), + KEY uid (user_id), + KEY id (image_id), + KEY aid (album_id) +); + + diff --git a/tests/schemas/mysql_41_schema.sql b/tests/schemas/mysql_41_schema.sql new file mode 100644 index 00000000..41f140b1 --- /dev/null +++ b/tests/schemas/mysql_41_schema.sql @@ -0,0 +1,1336 @@ +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + physical_filename varchar(255) DEFAULT '' NOT NULL, + real_filename varchar(255) DEFAULT '' NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_comment text NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + mimetype varchar(100) DEFAULT '' NOT NULL, + filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, + thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id), + KEY filetime (filetime), + KEY post_msg_id (post_msg_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY is_orphan (is_orphan) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY group_id (group_id), + KEY auth_opt_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, + auth_option varchar(50) DEFAULT '' NOT NULL, + is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + UNIQUE auth_option (auth_option) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + role_name varchar(255) DEFAULT '' NOT NULL, + role_description text NOT NULL, + role_type varchar(10) DEFAULT '' NOT NULL, + role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id), + KEY role_type (role_type), + KEY role_order (role_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id), + KEY ath_op_id (auth_option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY user_id (user_id), + KEY auth_option_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + ban_ip varchar(40) DEFAULT '' NOT NULL, + ban_email varchar(100) DEFAULT '' NOT NULL, + ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ban_reason varchar(255) DEFAULT '' NOT NULL, + ban_give_reason varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (ban_id), + KEY ban_end (ban_end), + KEY ban_user (ban_userid, ban_exclude), + KEY ban_email (ban_email, ban_exclude), + KEY ban_ip (ban_ip, ban_exclude) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_tag varchar(16) DEFAULT '' NOT NULL, + bbcode_helpline varchar(255) DEFAULT '' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_match text NOT NULL, + bbcode_tpl mediumtext NOT NULL, + first_pass_match mediumtext NOT NULL, + first_pass_replace mediumtext NOT NULL, + second_pass_match mediumtext NOT NULL, + second_pass_replace mediumtext NOT NULL, + PRIMARY KEY (bbcode_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id, user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, + bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + bot_name varchar(255) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bot_agent varchar(255) DEFAULT '' NOT NULL, + bot_ip varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id), + KEY bot_active (bot_active) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_config_text' +CREATE TABLE phpbb_config_text ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value mediumtext NOT NULL, + PRIMARY KEY (config_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + confirm_type tinyint(3) DEFAULT '0' NOT NULL, + code varchar(8) DEFAULT '' NOT NULL, + seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id, confirm_id), + KEY confirm_type (confirm_type) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (disallow_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + draft_subject varchar(255) DEFAULT '' NOT NULL, + draft_message mediumtext NOT NULL, + PRIMARY KEY (draft_id), + KEY save_time (save_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state text NOT NULL, + UNIQUE ext_name (ext_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_name varchar(255) DEFAULT '' NOT NULL, + cat_id tinyint(2) DEFAULT '0' NOT NULL, + allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + upload_icon varchar(255) DEFAULT '' NOT NULL, + max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + allowed_forums text NOT NULL, + allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_parents mediumtext NOT NULL, + forum_name varchar(255) DEFAULT '' NOT NULL, + forum_desc text NOT NULL, + forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_desc_uid varchar(8) DEFAULT '' NOT NULL, + forum_link varchar(255) DEFAULT '' NOT NULL, + forum_password varchar(40) DEFAULT '' NOT NULL, + forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_image varchar(255) DEFAULT '' NOT NULL, + forum_rules text NOT NULL, + forum_rules_link varchar(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_rules_uid varchar(8) DEFAULT '' NOT NULL, + forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, + forum_type tinyint(4) DEFAULT '0' NOT NULL, + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, + forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, + display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, + prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_right_id (left_id, right_id), + KEY forum_lastpost_id (forum_last_post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + group_desc text NOT NULL, + group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + group_desc_uid varchar(8) DEFAULT '' NOT NULL, + group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar varchar(255) DEFAULT '' NOT NULL, + group_avatar_type varchar(255) DEFAULT '' NOT NULL, + group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_colour varchar(6) DEFAULT '' NOT NULL, + group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id), + KEY group_legend_name (group_legend, group_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, + icons_url varchar(255) DEFAULT '' NOT NULL, + icons_width tinyint(4) DEFAULT '0' NOT NULL, + icons_height tinyint(4) DEFAULT '0' NOT NULL, + icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (icons_id), + KEY display_on_posting (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id tinyint(4) NOT NULL auto_increment, + lang_iso varchar(30) DEFAULT '' NOT NULL, + lang_dir varchar(30) DEFAULT '' NOT NULL, + lang_english_name varchar(100) DEFAULT '' NOT NULL, + lang_local_name varchar(255) DEFAULT '' NOT NULL, + lang_author varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (lang_id), + KEY lang_iso (lang_iso) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id mediumint(8) UNSIGNED NOT NULL auto_increment, + log_type tinyint(4) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_ip varchar(40) DEFAULT '' NOT NULL, + log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + log_operation text NOT NULL, + log_data mediumtext NOT NULL, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (log_id), + KEY log_type (log_type), + KEY log_time (log_time), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY reportee_id (reportee_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) DEFAULT '' NOT NULL, + attempt_browser varchar(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, + attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '0' NOT NULL, + username_clean varchar(255) DEFAULT '0' NOT NULL, + KEY att_ip (attempt_ip, attempt_time), + KEY att_for (attempt_forwarded_for, attempt_time), + KEY att_time (attempt_time), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY disp_idx (display_on_index), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_migrations' +CREATE TABLE phpbb_migrations ( + migration_name varchar(255) DEFAULT '' NOT NULL, + migration_depends_on text NOT NULL, + migration_schema_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + migration_data_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + migration_data_state text NOT NULL, + migration_start_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + migration_end_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (migration_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id mediumint(8) UNSIGNED NOT NULL auto_increment, + module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_basename varchar(255) DEFAULT '' NOT NULL, + module_class varchar(10) DEFAULT '' NOT NULL, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + module_langname varchar(255) DEFAULT '' NOT NULL, + module_mode varchar(255) DEFAULT '' NOT NULL, + module_auth varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id), + KEY left_right_id (left_id, right_id), + KEY module_enabled (module_enabled), + KEY class_left_id (module_class, left_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_notification_types' +CREATE TABLE phpbb_notification_types ( + notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment, + notification_type_name varchar(255) DEFAULT '' NOT NULL, + notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (notification_type_id), + UNIQUE type (notification_type_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id int(10) UNSIGNED NOT NULL auto_increment, + notification_type_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL, + notification_data text NOT NULL, + PRIMARY KEY (notification_id), + KEY item_ident (notification_type_id, item_id), + KEY user (user_id, notification_read) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_oauth_accounts' +CREATE TABLE phpbb_oauth_accounts ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + provider varchar(255) DEFAULT '' NOT NULL, + oauth_provider_id text NOT NULL, + PRIMARY KEY (user_id, provider) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_oauth_tokens' +CREATE TABLE phpbb_oauth_tokens ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + provider varchar(255) DEFAULT '' NOT NULL, + oauth_token mediumtext NOT NULL, + KEY user_id (user_id), + KEY provider (provider) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_text text NOT NULL, + poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + KEY poll_opt_id (poll_option_id), + KEY topic_id (topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + vote_user_ip varchar(40) DEFAULT '' NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varchar(40) DEFAULT '' NOT NULL, + post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_visibility tinyint(3) DEFAULT '0' NOT NULL, + post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_username varchar(255) DEFAULT '' NOT NULL, + post_subject varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + post_text mediumtext NOT NULL, + post_checksum varchar(32) DEFAULT '' NOT NULL, + post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_reason varchar(255) DEFAULT '' NOT NULL, + post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_delete_reason varchar(255) DEFAULT '' NOT NULL, + post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_ip (poster_ip), + KEY poster_id (poster_id), + KEY post_visibility (post_visibility), + KEY post_username (post_username), + KEY tid_post_time (topic_id, post_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, + root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_ip varchar(40) DEFAULT '' NOT NULL, + message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + message_subject varchar(255) DEFAULT '' NOT NULL, + message_text mediumtext NOT NULL, + message_edit_reason varchar(255) DEFAULT '' NOT NULL, + message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + to_address text NOT NULL, + bcc_address text NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (msg_id), + KEY author_ip (author_ip), + KEY message_time (message_time), + KEY author_id (author_id), + KEY root_level (root_level) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + folder_name varchar(255) DEFAULT '' NOT NULL, + pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (folder_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_string varchar(255) DEFAULT '' NOT NULL, + rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_folder_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + folder_id int(11) DEFAULT '0' NOT NULL, + KEY msg_id (msg_id), + KEY author_id (author_id), + KEY usr_flder_id (user_id, folder_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id mediumint(8) UNSIGNED NOT NULL auto_increment, + field_name varchar(255) DEFAULT '' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + field_ident varchar(20) DEFAULT '' NOT NULL, + field_length varchar(20) DEFAULT '' NOT NULL, + field_minlen varchar(255) DEFAULT '' NOT NULL, + field_maxlen varchar(255) DEFAULT '' NOT NULL, + field_novalue varchar(255) DEFAULT '' NOT NULL, + field_default_value varchar(255) DEFAULT '' NOT NULL, + field_validation varchar(20) DEFAULT '' NOT NULL, + field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (field_id), + KEY fld_type (field_type), + KEY fld_ordr (field_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + lang_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_name varchar(255) DEFAULT '' NOT NULL, + lang_explain text NOT NULL, + lang_default_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, + rank_title varchar(255) DEFAULT '' NOT NULL, + rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + rank_image varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_text mediumtext NOT NULL, + reported_post_text mediumtext NOT NULL, + reported_post_uid varchar(8) DEFAULT '' NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, + reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint(4) UNSIGNED NOT NULL auto_increment, + reason_title varchar(255) DEFAULT '' NOT NULL, + reason_description mediumtext NOT NULL, + reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (reason_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varchar(32) DEFAULT '' NOT NULL, + search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + search_keywords mediumtext NOT NULL, + search_authors mediumtext NOT NULL, + PRIMARY KEY (search_key) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_text varchar(255) DEFAULT '' NOT NULL, + word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (word_id), + UNIQUE wrd_txt (word_text), + KEY wrd_cnt (word_count) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE unq_mtch (word_id, post_id, title_match), + KEY word_id (word_id), + KEY post_id (post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_ip varchar(40) DEFAULT '' NOT NULL, + session_browser varchar(150) DEFAULT '' NOT NULL, + session_forwarded_for varchar(255) DEFAULT '' NOT NULL, + session_page varchar(255) DEFAULT '' NOT NULL, + session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time), + KEY session_user_id (session_user_id), + KEY session_fid (session_forum_id), + KEY session_aid (session_album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + last_ip varchar(40) DEFAULT '' NOT NULL, + last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (key_id, user_id), + KEY last_login (last_login) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id mediumint(8) UNSIGNED NOT NULL auto_increment, + site_ip varchar(40) DEFAULT '' NOT NULL, + site_hostname varchar(255) DEFAULT '' NOT NULL, + ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (site_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, + code varchar(50) DEFAULT '' NOT NULL, + emotion varchar(50) DEFAULT '' NOT NULL, + smiley_url varchar(50) DEFAULT '' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smiley_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id mediumint(8) UNSIGNED NOT NULL auto_increment, + style_name varchar(255) DEFAULT '' NOT NULL, + style_copyright varchar(255) DEFAULT '' NOT NULL, + style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + style_path varchar(100) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, + style_parent_tree text NOT NULL, + PRIMARY KEY (style_id), + UNIQUE style_name (style_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_name varchar(255) DEFAULT '' NOT NULL, + teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (teampage_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_visibility tinyint(3) DEFAULT '0' NOT NULL, + topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, + topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title varchar(255) DEFAULT '' NOT NULL, + poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_max_options tinyint(4) DEFAULT '1' NOT NULL, + poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_delete_reason varchar(255) DEFAULT '' NOT NULL, + topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY forum_id_type (forum_id, topic_type), + KEY last_post_time (topic_last_post_time), + KEY topic_visibility (topic_visibility), + KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id), + KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id), + KEY topic_id (topic_id), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + method varchar(255) DEFAULT '' NOT NULL, + notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY group_id (group_id), + KEY user_id (user_id), + KEY group_leader (group_leader) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_type tinyint(2) DEFAULT '0' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, + user_permissions mediumtext NOT NULL, + user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_ip varchar(40) DEFAULT '' NOT NULL, + user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + username_clean varchar(255) DEFAULT '' NOT NULL, + user_password varchar(40) DEFAULT '' NOT NULL, + user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_email varchar(100) DEFAULT '' NOT NULL, + user_email_hash bigint(20) DEFAULT '0' NOT NULL, + user_birthday varchar(10) DEFAULT '' NOT NULL, + user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpage varchar(200) DEFAULT '' NOT NULL, + user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, + user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_warnings tinyint(4) DEFAULT '0' NOT NULL, + user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, + user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, + user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varchar(30) DEFAULT '' NOT NULL, + user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, + user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_colour varchar(6) DEFAULT '' NOT NULL, + user_new_privmsg int(4) DEFAULT '0' NOT NULL, + user_unread_privmsg int(4) DEFAULT '0' NOT NULL, + user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_full_folder int(11) DEFAULT '-3' NOT NULL, + user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_notify_type tinyint(4) DEFAULT '0' NOT NULL, + user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, + user_avatar varchar(255) DEFAULT '' NOT NULL, + user_avatar_type varchar(255) DEFAULT '' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_sig mediumtext NOT NULL, + user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + user_from varchar(100) DEFAULT '' NOT NULL, + user_icq varchar(15) DEFAULT '' NOT NULL, + user_aim varchar(255) DEFAULT '' NOT NULL, + user_yim varchar(255) DEFAULT '' NOT NULL, + user_msnm varchar(255) DEFAULT '' NOT NULL, + user_jabber varchar(255) DEFAULT '' NOT NULL, + user_website varchar(200) DEFAULT '' NOT NULL, + user_occ text NOT NULL, + user_interests text NOT NULL, + user_actkey varchar(32) DEFAULT '' NOT NULL, + user_newpasswd varchar(40) DEFAULT '' NOT NULL, + user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY user_birthday (user_birthday), + KEY user_email_hash (user_email_hash), + KEY user_type (user_type), + UNIQUE username_clean (username_clean) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word varchar(255) DEFAULT '' NOT NULL, + replacement varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (word_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, zebra_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_albums' +CREATE TABLE phpbb_gallery_albums ( + album_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '1' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '2' NOT NULL, + album_parents mediumtext NOT NULL, + album_type int(3) UNSIGNED DEFAULT '1' NOT NULL, + album_status int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_contest mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_name varchar(255) DEFAULT '' NOT NULL, + album_desc mediumtext NOT NULL, + album_desc_options int(3) UNSIGNED DEFAULT '7' NOT NULL, + album_desc_uid varchar(8) DEFAULT '' NOT NULL, + album_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + album_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_images mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_images_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_last_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_image varchar(255) DEFAULT '' NOT NULL, + album_last_image_time int(11) DEFAULT '0' NOT NULL, + album_last_image_name varchar(255) DEFAULT '' NOT NULL, + album_last_username varchar(255) DEFAULT '' NOT NULL, + album_last_user_colour varchar(6) DEFAULT '' NOT NULL, + album_last_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_watermark int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_sort_key varchar(8) DEFAULT '' NOT NULL, + album_sort_dir varchar(8) DEFAULT '' NOT NULL, + display_in_rrc int(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index int(1) UNSIGNED DEFAULT '1' NOT NULL, + display_subalbum_list int(1) UNSIGNED DEFAULT '1' NOT NULL, + album_feed tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + album_auth_access tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_albums_track' +CREATE TABLE phpbb_gallery_albums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_comments' +CREATE TABLE phpbb_gallery_comments ( + comment_id mediumint(8) UNSIGNED NOT NULL auto_increment, + comment_image_id mediumint(8) UNSIGNED NOT NULL, + comment_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + comment_username varchar(255) DEFAULT '' NOT NULL, + comment_user_colour varchar(6) DEFAULT '' NOT NULL, + comment_user_ip varchar(40) DEFAULT '' NOT NULL, + comment_signature tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + comment_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + comment mediumtext NOT NULL, + comment_uid varchar(8) DEFAULT '' NOT NULL, + comment_bitfield varchar(255) DEFAULT '' NOT NULL, + comment_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + comment_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + comment_edit_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (comment_id), + KEY id (comment_image_id), + KEY uid (comment_user_id), + KEY ip (comment_user_ip), + KEY time (comment_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_contests' +CREATE TABLE phpbb_gallery_contests ( + contest_id mediumint(8) UNSIGNED NOT NULL auto_increment, + contest_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_rating int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + contest_marked tinyint(1) DEFAULT '0' NOT NULL, + contest_first mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_second mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + contest_third mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (contest_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_favorites' +CREATE TABLE phpbb_gallery_favorites ( + favorite_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (favorite_id), + KEY uid (user_id), + KEY id (image_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_images' +CREATE TABLE phpbb_gallery_images ( + image_id mediumint(8) UNSIGNED NOT NULL auto_increment, + image_filename varchar(255) DEFAULT '' NOT NULL, + image_name varchar(255) DEFAULT '' NOT NULL, + image_name_clean varchar(255) DEFAULT '' NOT NULL, + image_desc mediumtext NOT NULL, + image_desc_uid varchar(8) DEFAULT '' NOT NULL, + image_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + image_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_username varchar(255) DEFAULT '' NOT NULL, + image_username_clean varchar(255) DEFAULT '' NOT NULL, + image_user_colour varchar(6) DEFAULT '' NOT NULL, + image_user_ip varchar(40) DEFAULT '' NOT NULL, + image_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_view_count int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_contest int(1) UNSIGNED DEFAULT '0' NOT NULL, + image_contest_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + image_contest_rank int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_filemissing int(3) UNSIGNED DEFAULT '0' NOT NULL, + image_has_exif int(3) UNSIGNED DEFAULT '2' NOT NULL, + image_exif_data text NOT NULL, + image_rates mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_rate_points mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_rate_avg mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_comments mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_last_comment mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_allow_comments tinyint(1) DEFAULT '1' NOT NULL, + image_favorited mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_reported mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + filesize_upload int(20) UNSIGNED DEFAULT '0' NOT NULL, + filesize_medium int(20) UNSIGNED DEFAULT '0' NOT NULL, + filesize_cache int(20) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (image_id), + KEY aid (image_album_id), + KEY uid (image_user_id), + KEY time (image_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_modscache' +CREATE TABLE phpbb_gallery_modscache ( + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index tinyint(1) DEFAULT '1' NOT NULL, + KEY doi (display_on_index), + KEY aid (album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_permissions' +CREATE TABLE phpbb_gallery_permissions ( + perm_id mediumint(8) UNSIGNED NOT NULL auto_increment, + perm_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + perm_system int(3) DEFAULT '0' NOT NULL, + PRIMARY KEY (perm_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_rates' +CREATE TABLE phpbb_gallery_rates ( + rate_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rate_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rate_user_ip varchar(40) DEFAULT '' NOT NULL, + rate_point int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (rate_image_id, rate_user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_reports' +CREATE TABLE phpbb_gallery_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + report_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reporter_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_manager mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + report_note mediumtext NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (report_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_roles' +CREATE TABLE phpbb_gallery_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + a_list int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_view int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_watermark int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_upload int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_rate int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_approve int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_lock int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_report int(3) UNSIGNED DEFAULT '0' NOT NULL, + i_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + i_unlimited int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_read int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_post int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + c_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_comments int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_delete int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_edit int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_move int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_report int(3) UNSIGNED DEFAULT '0' NOT NULL, + m_status int(3) UNSIGNED DEFAULT '0' NOT NULL, + a_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + a_unlimited int(3) UNSIGNED DEFAULT '0' NOT NULL, + a_restrict int(3) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_users' +CREATE TABLE phpbb_gallery_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + watch_own int(3) UNSIGNED DEFAULT '0' NOT NULL, + watch_favo int(3) UNSIGNED DEFAULT '0' NOT NULL, + watch_com int(3) UNSIGNED DEFAULT '0' NOT NULL, + user_images mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + personal_album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_last_update int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_viewexif int(1) UNSIGNED DEFAULT '0' NOT NULL, + user_permissions mediumtext NOT NULL, + user_permissions_changed int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_allow_comments tinyint(1) DEFAULT '1' NOT NULL, + subscribe_pegas tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY pega (personal_album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_gallery_watch' +CREATE TABLE phpbb_gallery_watch ( + watch_id mediumint(8) UNSIGNED NOT NULL auto_increment, + album_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + image_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (watch_id), + KEY uid (user_id), + KEY id (image_id), + KEY aid (album_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + diff --git a/tests/schemas/oracle_schema.sql b/tests/schemas/oracle_schema.sql new file mode 100644 index 00000000..2b24f8d1 --- /dev/null +++ b/tests/schemas/oracle_schema.sql @@ -0,0 +1,2420 @@ +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +/* + This first section is optional, however its probably the best method + of running phpBB on Oracle. If you already have a tablespace and user created + for phpBB you can leave this section commented out! + + The first set of statements create a phpBB tablespace and a phpBB user, + make sure you change the password of the phpBB user before you run this script!! +*/ + +/* +CREATE TABLESPACE "PHPBB" + LOGGING + DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' + SIZE 10M + AUTOEXTEND ON NEXT 10M + MAXSIZE 100M; + +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; + +CONNECT phpbb/phpbb_password; +*/ +/* + Table: 'phpbb_attachments' +*/ +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, + is_orphan number(1) DEFAULT '1' NOT NULL, + physical_filename varchar2(255) DEFAULT '' , + real_filename varchar2(255) DEFAULT '' , + download_count number(8) DEFAULT '0' NOT NULL, + attach_comment clob DEFAULT '' , + extension varchar2(100) DEFAULT '' , + mimetype varchar2(100) DEFAULT '' , + filesize number(20) DEFAULT '0' 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 INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime) +/ +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id) +/ +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) +/ +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) +/ +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) +/ + +CREATE SEQUENCE phpbb_attachments_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_attachments +BEFORE INSERT ON phpbb_attachments +FOR EACH ROW WHEN ( + new.attach_id IS NULL OR new.attach_id = 0 +) +BEGIN + SELECT phpbb_attachments_seq.nextval + INTO :new.attach_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE phpbb_acl_groups ( + group_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_role_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id) +/ +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id) +/ +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id) +/ + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE phpbb_acl_options ( + auth_option_id number(8) NOT NULL, + auth_option varchar2(50) DEFAULT '' , + 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_acl_options PRIMARY KEY (auth_option_id), + CONSTRAINT u_phpbb_auth_option UNIQUE (auth_option) +) +/ + + +CREATE SEQUENCE phpbb_acl_options_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_acl_options +BEFORE INSERT ON phpbb_acl_options +FOR EACH ROW WHEN ( + new.auth_option_id IS NULL OR new.auth_option_id = 0 +) +BEGIN + SELECT phpbb_acl_options_seq.nextval + INTO :new.auth_option_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE phpbb_acl_roles ( + role_id number(8) NOT NULL, + role_name varchar2(765) DEFAULT '' , + role_description clob DEFAULT '' , + role_type varchar2(10) DEFAULT '' , + role_order number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_acl_roles PRIMARY KEY (role_id) +) +/ + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type) +/ +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order) +/ + +CREATE SEQUENCE phpbb_acl_roles_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_acl_roles +BEFORE INSERT ON phpbb_acl_roles +FOR EACH ROW WHEN ( + new.role_id IS NULL OR new.role_id = 0 +) +BEGIN + SELECT phpbb_acl_roles_seq.nextval + INTO :new.role_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE phpbb_acl_roles_data ( + role_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_acl_roles_data PRIMARY KEY (role_id, auth_option_id) +) +/ + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id) +/ + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE phpbb_acl_users ( + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_role_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id) +/ +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id) +/ +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id) +/ + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE phpbb_banlist ( + ban_id number(8) NOT NULL, + ban_userid number(8) DEFAULT '0' NOT NULL, + ban_ip varchar2(40) DEFAULT '' , + ban_email varchar2(300) 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(765) DEFAULT '' , + ban_give_reason varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id) +) +/ + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end) +/ +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude) +/ +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude) +/ +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude) +/ + +CREATE SEQUENCE phpbb_banlist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_banlist +BEFORE INSERT ON phpbb_banlist +FOR EACH ROW WHEN ( + new.ban_id IS NULL OR new.ban_id = 0 +) +BEGIN + SELECT phpbb_banlist_seq.nextval + INTO :new.ban_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id number(4) DEFAULT '0' NOT NULL, + bbcode_tag varchar2(16) DEFAULT '' , + bbcode_helpline varchar2(765) DEFAULT '' , + display_on_posting number(1) DEFAULT '0' NOT NULL, + bbcode_match clob DEFAULT '' , + bbcode_tpl clob DEFAULT '' , + first_pass_match clob DEFAULT '' , + first_pass_replace clob DEFAULT '' , + second_pass_match clob DEFAULT '' , + second_pass_replace clob DEFAULT '' , + CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id) +) +/ + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting) +/ + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_bookmarks PRIMARY KEY (topic_id, user_id) +) +/ + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE phpbb_bots ( + bot_id number(8) NOT NULL, + bot_active number(1) DEFAULT '1' NOT NULL, + bot_name varchar2(765) 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 INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active) +/ + +CREATE SEQUENCE phpbb_bots_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_bots +BEFORE INSERT ON phpbb_bots +FOR EACH ROW WHEN ( + new.bot_id IS NULL OR new.bot_id = 0 +) +BEGIN + SELECT phpbb_bots_seq.nextval + INTO :new.bot_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE phpbb_config ( + config_name varchar2(255) DEFAULT '' , + config_value varchar2(765) DEFAULT '' , + is_dynamic number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name) +) +/ + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic) +/ + +/* + Table: 'phpbb_config_text' +*/ +CREATE TABLE phpbb_config_text ( + config_name varchar2(255) DEFAULT '' , + config_value clob DEFAULT '' , + CONSTRAINT pk_phpbb_config_text PRIMARY KEY (config_name) +) +/ + + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' , + session_id char(32) DEFAULT '' , + confirm_type number(3) DEFAULT '0' NOT NULL, + code varchar2(8) DEFAULT '' , + seed number(10) DEFAULT '0' NOT NULL, + attempts number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) +) +/ + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type) +/ + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE phpbb_disallow ( + disallow_id number(8) NOT NULL, + disallow_username varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id) +) +/ + + +CREATE SEQUENCE phpbb_disallow_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_disallow +BEFORE INSERT ON phpbb_disallow +FOR EACH ROW WHEN ( + new.disallow_id IS NULL OR new.disallow_id = 0 +) +BEGIN + SELECT phpbb_disallow_seq.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(765) DEFAULT '' , + draft_message clob DEFAULT '' , + CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id) +) +/ + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time) +/ + +CREATE SEQUENCE phpbb_drafts_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_drafts +BEFORE INSERT ON phpbb_drafts +FOR EACH ROW WHEN ( + new.draft_id IS NULL OR new.draft_id = 0 +) +BEGIN + SELECT phpbb_drafts_seq.nextval + INTO :new.draft_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar2(255) DEFAULT '' , + ext_active number(1) DEFAULT '0' NOT NULL, + ext_state clob DEFAULT '' , + CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) +) +/ + + +/* + 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 phpbb_extensions_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_extensions +BEFORE INSERT ON phpbb_extensions +FOR EACH ROW WHEN ( + new.extension_id IS NULL OR new.extension_id = 0 +) +BEGIN + SELECT phpbb_extensions_seq.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(765) DEFAULT '' , + 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(255) DEFAULT '' , + max_filesize number(20) DEFAULT '0' NOT NULL, + allowed_forums clob DEFAULT '' , + allow_in_pm number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id) +) +/ + + +CREATE SEQUENCE phpbb_extension_groups_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_extension_groups +BEFORE INSERT ON phpbb_extension_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT phpbb_extension_groups_seq.nextval + INTO :new.group_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE phpbb_forums ( + forum_id number(8) NOT NULL, + parent_id number(8) DEFAULT '0' NOT NULL, + left_id number(8) DEFAULT '0' NOT NULL, + right_id number(8) DEFAULT '0' NOT NULL, + forum_parents clob DEFAULT '' , + forum_name varchar2(765) DEFAULT '' , + forum_desc clob DEFAULT '' , + forum_desc_bitfield varchar2(255) DEFAULT '' , + forum_desc_options number(11) DEFAULT '7' NOT NULL, + forum_desc_uid varchar2(8) DEFAULT '' , + forum_link varchar2(765) DEFAULT '' , + forum_password varchar2(120) DEFAULT '' , + forum_style number(8) DEFAULT '0' NOT NULL, + forum_image varchar2(255) DEFAULT '' , + forum_rules clob DEFAULT '' , + forum_rules_link varchar2(765) DEFAULT '' , + forum_rules_bitfield varchar2(255) DEFAULT '' , + forum_rules_options number(11) DEFAULT '7' NOT NULL, + forum_rules_uid varchar2(8) 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_approved number(8) DEFAULT '0' NOT NULL, + forum_posts_unapproved number(8) DEFAULT '0' NOT NULL, + forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL, + forum_topics_approved number(8) DEFAULT '0' NOT NULL, + forum_topics_unapproved number(8) DEFAULT '0' NOT NULL, + forum_topics_softdeleted 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_subject varchar2(765) DEFAULT '' , + forum_last_post_time number(11) DEFAULT '0' NOT NULL, + forum_last_poster_name varchar2(765) DEFAULT '' , + forum_last_poster_colour varchar2(6) DEFAULT '' , + forum_flags number(4) DEFAULT '32' NOT NULL, + forum_options number(20) DEFAULT '0' NOT NULL, + display_subforum_list number(1) DEFAULT '1' 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) DEFAULT '0' NOT NULL, + prune_days number(8) DEFAULT '0' NOT NULL, + prune_viewed number(8) DEFAULT '0' NOT NULL, + prune_freq number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id) +) +/ + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id) +/ +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id) +/ + +CREATE SEQUENCE phpbb_forums_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_forums +BEFORE INSERT ON phpbb_forums +FOR EACH ROW WHEN ( + new.forum_id IS NULL OR new.forum_id = 0 +) +BEGIN + SELECT phpbb_forums_seq.nextval + INTO :new.forum_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE phpbb_forums_access ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' , + CONSTRAINT pk_phpbb_forums_access PRIMARY KEY (forum_id, user_id, session_id) +) +/ + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE phpbb_forums_track ( + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums_track PRIMARY KEY (user_id, forum_id) +) +/ + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE phpbb_forums_watch ( + forum_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 phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id) +/ +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id) +/ +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status) +/ + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE phpbb_groups ( + group_id number(8) NOT NULL, + group_type number(4) DEFAULT '1' NOT NULL, + group_founder_manage number(1) DEFAULT '0' NOT NULL, + group_skip_auth number(1) DEFAULT '0' NOT NULL, + group_name varchar2(255) DEFAULT '' , + group_desc clob DEFAULT '' , + group_desc_bitfield varchar2(255) DEFAULT '' , + group_desc_options number(11) DEFAULT '7' NOT NULL, + group_desc_uid varchar2(8) DEFAULT '' , + group_display number(1) DEFAULT '0' NOT NULL, + group_avatar varchar2(255) DEFAULT '' , + group_avatar_type varchar2(255) DEFAULT '' , + group_avatar_width number(4) DEFAULT '0' NOT NULL, + group_avatar_height number(4) DEFAULT '0' NOT NULL, + group_rank number(8) DEFAULT '0' 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_max_recipients number(8) DEFAULT '0' NOT NULL, + group_legend number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) +) +/ + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name) +/ + +CREATE SEQUENCE phpbb_groups_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_groups +BEFORE INSERT ON phpbb_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT phpbb_groups_seq.nextval + INTO :new.group_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE phpbb_icons ( + icons_id number(8) NOT NULL, + icons_url varchar2(255) DEFAULT '' , + icons_width number(4) DEFAULT '0' NOT NULL, + icons_height number(4) DEFAULT '0' NOT NULL, + icons_order number(8) DEFAULT '0' NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id) +) +/ + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting) +/ + +CREATE SEQUENCE phpbb_icons_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_icons +BEFORE INSERT ON phpbb_icons +FOR EACH ROW WHEN ( + new.icons_id IS NULL OR new.icons_id = 0 +) +BEGIN + SELECT phpbb_icons_seq.nextval + INTO :new.icons_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE phpbb_lang ( + lang_id number(4) NOT NULL, + lang_iso varchar2(30) DEFAULT '' , + lang_dir varchar2(30) DEFAULT '' , + lang_english_name varchar2(300) DEFAULT '' , + lang_local_name varchar2(765) DEFAULT '' , + lang_author varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id) +) +/ + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso) +/ + +CREATE SEQUENCE phpbb_lang_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_lang +BEFORE INSERT ON phpbb_lang +FOR EACH ROW WHEN ( + new.lang_id IS NULL OR new.lang_id = 0 +) +BEGIN + SELECT phpbb_lang_seq.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) DEFAULT '' , + log_time number(11) DEFAULT '0' NOT NULL, + log_operation clob DEFAULT '' , + log_data clob DEFAULT '' , + album_id number(8) DEFAULT '0' NOT NULL, + image_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id) +) +/ + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type) +/ +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time) +/ +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id) +/ +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id) +/ +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id) +/ +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id) +/ + +CREATE SEQUENCE phpbb_log_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_log +BEFORE INSERT ON phpbb_log +FOR EACH ROW WHEN ( + new.log_id IS NULL OR new.log_id = 0 +) +BEGIN + SELECT phpbb_log_seq.nextval + INTO :new.log_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar2(40) DEFAULT '' , + attempt_browser varchar2(150) DEFAULT '' , + attempt_forwarded_for varchar2(255) DEFAULT '' , + attempt_time number(11) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(765) DEFAULT '0' NOT NULL, + username_clean varchar2(255) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time) +/ +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time) +/ +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time) +/ +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id) +/ + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(765) DEFAULT '' , + group_id number(8) DEFAULT '0' NOT NULL, + group_name varchar2(765) DEFAULT '' , + display_on_index number(1) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index) +/ +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id) +/ + +/* + Table: 'phpbb_migrations' +*/ +CREATE TABLE phpbb_migrations ( + migration_name varchar2(255) DEFAULT '' , + migration_depends_on clob DEFAULT '' , + migration_schema_done number(1) DEFAULT '0' NOT NULL, + migration_data_done number(1) DEFAULT '0' NOT NULL, + migration_data_state clob DEFAULT '' , + migration_start_time number(11) DEFAULT '0' NOT NULL, + migration_end_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_migrations PRIMARY KEY (migration_name) +) +/ + + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE phpbb_modules ( + module_id number(8) NOT NULL, + module_enabled number(1) DEFAULT '1' NOT NULL, + module_display number(1) DEFAULT '1' NOT NULL, + module_basename varchar2(255) DEFAULT '' , + module_class varchar2(10) DEFAULT '' , + parent_id number(8) DEFAULT '0' NOT NULL, + left_id number(8) DEFAULT '0' NOT NULL, + right_id number(8) DEFAULT '0' NOT NULL, + module_langname varchar2(255) DEFAULT '' , + module_mode varchar2(255) DEFAULT '' , + module_auth varchar2(255) DEFAULT '' , + CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id) +) +/ + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id) +/ +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled) +/ +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id) +/ + +CREATE SEQUENCE phpbb_modules_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_modules +BEFORE INSERT ON phpbb_modules +FOR EACH ROW WHEN ( + new.module_id IS NULL OR new.module_id = 0 +) +BEGIN + SELECT phpbb_modules_seq.nextval + INTO :new.module_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_notification_types' +*/ +CREATE TABLE phpbb_notification_types ( + notification_type_id number(4) NOT NULL, + notification_type_name varchar2(255) DEFAULT '' , + notification_type_enabled number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_notification_types PRIMARY KEY (notification_type_id), + CONSTRAINT u_phpbb_type UNIQUE (notification_type_name) +) +/ + + +CREATE SEQUENCE phpbb_notification_types_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_notification_types +BEFORE INSERT ON phpbb_notification_types +FOR EACH ROW WHEN ( + new.notification_type_id IS NULL OR new.notification_type_id = 0 +) +BEGIN + SELECT phpbb_notification_types_seq.nextval + INTO :new.notification_type_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_notifications' +*/ +CREATE TABLE phpbb_notifications ( + notification_id number(10) NOT NULL, + notification_type_id number(4) DEFAULT '0' NOT NULL, + item_id number(8) DEFAULT '0' NOT NULL, + item_parent_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + notification_read number(1) DEFAULT '0' NOT NULL, + notification_time number(11) DEFAULT '1' NOT NULL, + notification_data clob DEFAULT '' , + CONSTRAINT pk_phpbb_notifications PRIMARY KEY (notification_id) +) +/ + +CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id) +/ +CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read) +/ + +CREATE SEQUENCE phpbb_notifications_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_notifications +BEFORE INSERT ON phpbb_notifications +FOR EACH ROW WHEN ( + new.notification_id IS NULL OR new.notification_id = 0 +) +BEGIN + SELECT phpbb_notifications_seq.nextval + INTO :new.notification_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_oauth_accounts' +*/ +CREATE TABLE phpbb_oauth_accounts ( + user_id number(8) DEFAULT '0' NOT NULL, + provider varchar2(255) DEFAULT '' , + oauth_provider_id clob DEFAULT '' , + CONSTRAINT pk_phpbb_oauth_accounts PRIMARY KEY (user_id, provider) +) +/ + + +/* + Table: 'phpbb_oauth_tokens' +*/ +CREATE TABLE phpbb_oauth_tokens ( + user_id number(8) DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' , + provider varchar2(255) DEFAULT '' , + oauth_token clob DEFAULT '' +) +/ + +CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id) +/ +CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider) +/ + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE phpbb_poll_options ( + poll_option_id number(4) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + poll_option_text clob DEFAULT '' , + poll_option_total number(8) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id) +/ +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id) +/ + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE phpbb_poll_votes ( + topic_id 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) DEFAULT '' +) +/ + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id) +/ +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id) +/ +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip) +/ + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE phpbb_posts ( + post_id number(8) NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + poster_id number(8) DEFAULT '0' NOT NULL, + icon_id number(8) DEFAULT '0' NOT NULL, + poster_ip varchar2(40) DEFAULT '' , + post_time number(11) DEFAULT '0' NOT NULL, + post_visibility number(3) DEFAULT '0' NOT NULL, + post_reported number(1) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' 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(765) DEFAULT '' , + post_subject varchar2(765) DEFAULT '' , + post_text clob DEFAULT '' , + post_checksum varchar2(32) DEFAULT '' , + post_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield varchar2(255) DEFAULT '' , + bbcode_uid varchar2(8) DEFAULT '' , + post_postcount number(1) DEFAULT '1' NOT NULL, + post_edit_time number(11) DEFAULT '0' NOT NULL, + post_edit_reason varchar2(765) DEFAULT '' , + post_edit_user number(8) DEFAULT '0' NOT NULL, + post_edit_count number(4) DEFAULT '0' NOT NULL, + post_edit_locked number(1) DEFAULT '0' NOT NULL, + post_delete_time number(11) DEFAULT '0' NOT NULL, + post_delete_reason varchar2(765) DEFAULT '' , + post_delete_user number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id) +) +/ + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id) +/ +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id) +/ +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip) +/ +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) +/ +CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility) +/ +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username) +/ +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) +/ + +CREATE SEQUENCE phpbb_posts_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_posts +BEFORE INSERT ON phpbb_posts +FOR EACH ROW WHEN ( + new.post_id IS NULL OR new.post_id = 0 +) +BEGIN + SELECT phpbb_posts_seq.nextval + INTO :new.post_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE phpbb_privmsgs ( + 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(8) DEFAULT '0' NOT NULL, + author_ip varchar2(40) DEFAULT '' , + message_time number(11) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' 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(765) DEFAULT '' , + message_text clob DEFAULT '' , + message_edit_reason varchar2(765) DEFAULT '' , + message_edit_user number(8) DEFAULT '0' NOT NULL, + message_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield varchar2(255) DEFAULT '' , + bbcode_uid varchar2(8) DEFAULT '' , + message_edit_time number(11) DEFAULT '0' NOT NULL, + message_edit_count number(4) DEFAULT '0' NOT NULL, + to_address clob DEFAULT '' , + bcc_address clob DEFAULT '' , + message_reported number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) +) +/ + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip) +/ +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time) +/ +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id) +/ +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level) +/ + +CREATE SEQUENCE phpbb_privmsgs_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs +BEFORE INSERT ON phpbb_privmsgs +FOR EACH ROW WHEN ( + new.msg_id IS NULL OR new.msg_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_seq.nextval + INTO :new.msg_id + FROM dual; +END; +/ + + +/* + 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(765) DEFAULT '' , + pm_count number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id) +) +/ + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id) +/ + +CREATE SEQUENCE phpbb_privmsgs_folder_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_folder +BEFORE INSERT ON phpbb_privmsgs_folder +FOR EACH ROW WHEN ( + new.folder_id IS NULL OR new.folder_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_folder_seq.nextval + INTO :new.folder_id + FROM dual; +END; +/ + + +/* + 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(8) DEFAULT '0' NOT NULL, + rule_connection number(8) DEFAULT '0' NOT NULL, + rule_string varchar2(765) DEFAULT '' , + rule_user_id number(8) DEFAULT '0' NOT NULL, + rule_group_id number(8) DEFAULT '0' NOT NULL, + rule_action number(8) DEFAULT '0' NOT NULL, + rule_folder_id number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id) +) +/ + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id) +/ + +CREATE SEQUENCE phpbb_privmsgs_rules_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_rules +BEFORE INSERT ON phpbb_privmsgs_rules +FOR EACH ROW WHEN ( + new.rule_id IS NULL OR new.rule_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_rules_seq.nextval + INTO :new.rule_id + FROM dual; +END; +/ + + +/* + 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, + pm_deleted number(1) DEFAULT '0' NOT NULL, + pm_new number(1) DEFAULT '1' NOT NULL, + pm_unread number(1) DEFAULT '1' NOT NULL, + pm_replied number(1) DEFAULT '0' NOT NULL, + pm_marked number(1) DEFAULT '0' NOT NULL, + pm_forwarded number(1) DEFAULT '0' NOT NULL, + folder_id number(11) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id) +/ +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id) +/ +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id) +/ + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE phpbb_profile_fields ( + field_id number(8) NOT NULL, + field_name varchar2(765) DEFAULT '' , + field_type number(4) DEFAULT '0' 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(765) DEFAULT '' , + field_default_value varchar2(765) DEFAULT '' , + field_validation varchar2(60) DEFAULT '' , + field_required number(1) DEFAULT '0' NOT NULL, + field_show_novalue number(1) DEFAULT '0' NOT NULL, + field_show_on_reg number(1) DEFAULT '0' NOT NULL, + field_show_on_pm number(1) DEFAULT '0' NOT NULL, + field_show_on_vt number(1) DEFAULT '0' NOT NULL, + field_show_profile 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(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id) +) +/ + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type) +/ +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order) +/ + +CREATE SEQUENCE phpbb_profile_fields_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_profile_fields +BEFORE INSERT ON phpbb_profile_fields +FOR EACH ROW WHEN ( + new.field_id IS NULL OR new.field_id = 0 +) +BEGIN + SELECT phpbb_profile_fields_seq.nextval + INTO :new.field_id + FROM dual; +END; +/ + + +/* + 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, + lang_value varchar2(765) 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(8) DEFAULT '0' NOT NULL, + lang_name varchar2(765) DEFAULT '' , + lang_explain clob DEFAULT '' , + lang_default_value varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id) +) +/ + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE phpbb_ranks ( + rank_id number(8) NOT NULL, + rank_title varchar2(765) DEFAULT '' , + rank_min number(8) DEFAULT '0' NOT NULL, + rank_special number(1) DEFAULT '0' NOT NULL, + rank_image varchar2(255) DEFAULT '' , + CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id) +) +/ + + +CREATE SEQUENCE phpbb_ranks_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_ranks +BEFORE INSERT ON phpbb_ranks +FOR EACH ROW WHEN ( + new.rank_id IS NULL OR new.rank_id = 0 +) +BEGIN + SELECT phpbb_ranks_seq.nextval + INTO :new.rank_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE phpbb_reports ( + report_id number(8) NOT NULL, + reason_id number(4) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + pm_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + user_notify number(1) DEFAULT '0' NOT NULL, + report_closed number(1) DEFAULT '0' NOT NULL, + report_time number(11) DEFAULT '0' NOT NULL, + report_text clob DEFAULT '' , + reported_post_text clob DEFAULT '' , + reported_post_uid varchar2(8) DEFAULT '' , + reported_post_bitfield varchar2(255) DEFAULT '' , + reported_post_enable_magic_url number(1) DEFAULT '1' NOT NULL, + reported_post_enable_smilies number(1) DEFAULT '1' NOT NULL, + reported_post_enable_bbcode number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) +) +/ + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id) +/ +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id) +/ + +CREATE SEQUENCE phpbb_reports_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_reports +BEFORE INSERT ON phpbb_reports +FOR EACH ROW WHEN ( + new.report_id IS NULL OR new.report_id = 0 +) +BEGIN + SELECT phpbb_reports_seq.nextval + INTO :new.report_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE phpbb_reports_reasons ( + reason_id number(4) NOT NULL, + reason_title varchar2(765) DEFAULT '' , + reason_description clob DEFAULT '' , + reason_order number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id) +) +/ + + +CREATE SEQUENCE phpbb_reports_reasons_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_reports_reasons +BEFORE INSERT ON phpbb_reports_reasons +FOR EACH ROW WHEN ( + new.reason_id IS NULL OR new.reason_id = 0 +) +BEGIN + SELECT phpbb_reports_reasons_seq.nextval + INTO :new.reason_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE phpbb_search_results ( + search_key varchar2(32) DEFAULT '' , + search_time number(11) DEFAULT '0' NOT NULL, + search_keywords clob DEFAULT '' , + search_authors clob DEFAULT '' , + CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_key) +) +/ + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE phpbb_search_wordlist ( + word_id number(8) NOT NULL, + word_text varchar2(765) DEFAULT '' , + word_common number(1) DEFAULT '0' NOT NULL, + word_count number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id), + CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text) +) +/ + +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count) +/ + +CREATE SEQUENCE phpbb_search_wordlist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_search_wordlist +BEFORE INSERT ON phpbb_search_wordlist +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) +BEGIN + SELECT phpbb_search_wordlist_seq.nextval + INTO :new.word_id + FROM dual; +END; +/ + + +/* + 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, + CONSTRAINT u_phpbb_unq_mtch UNIQUE (word_id, post_id, title_match) +) +/ + +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id) +/ +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id) +/ + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' , + session_user_id number(8) DEFAULT '0' NOT NULL, + session_forum_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 '' , + session_browser varchar2(150) DEFAULT '' , + session_forwarded_for varchar2(255) DEFAULT '' , + session_page varchar2(765) DEFAULT '' , + session_viewonline number(1) DEFAULT '1' NOT NULL, + session_autologin number(1) DEFAULT '0' NOT NULL, + session_admin number(1) DEFAULT '0' NOT NULL, + session_album_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id) +) +/ + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time) +/ +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id) +/ +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id) +/ +CREATE INDEX phpbb_sessions_session_aid ON phpbb_sessions (session_album_id) +/ + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' , + user_id number(8) DEFAULT '0' NOT NULL, + last_ip varchar2(40) DEFAULT '' , + last_login number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sessions_keys PRIMARY KEY (key_id, user_id) +) +/ + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login) +/ + +/* + 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 phpbb_sitelist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_sitelist +BEFORE INSERT ON phpbb_sitelist +FOR EACH ROW WHEN ( + new.site_id IS NULL OR new.site_id = 0 +) +BEGIN + SELECT phpbb_sitelist_seq.nextval + INTO :new.site_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE phpbb_smilies ( + smiley_id number(8) NOT NULL, + code varchar2(150) DEFAULT '' , + emotion varchar2(150) DEFAULT '' , + smiley_url varchar2(50) DEFAULT '' , + smiley_width number(4) DEFAULT '0' NOT NULL, + smiley_height number(4) DEFAULT '0' NOT NULL, + smiley_order number(8) DEFAULT '0' NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id) +) +/ + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting) +/ + +CREATE SEQUENCE phpbb_smilies_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_smilies +BEFORE INSERT ON phpbb_smilies +FOR EACH ROW WHEN ( + new.smiley_id IS NULL OR new.smiley_id = 0 +) +BEGIN + SELECT phpbb_smilies_seq.nextval + INTO :new.smiley_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE phpbb_styles ( + style_id number(8) NOT NULL, + style_name varchar2(765) DEFAULT '' , + style_copyright varchar2(765) DEFAULT '' , + style_active number(1) DEFAULT '1' NOT NULL, + style_path varchar2(100) DEFAULT '' , + bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id number(4) DEFAULT '0' NOT NULL, + style_parent_tree clob DEFAULT '' , + CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id), + CONSTRAINT u_phpbb_style_name UNIQUE (style_name) +) +/ + + +CREATE SEQUENCE phpbb_styles_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_styles +BEFORE INSERT ON phpbb_styles +FOR EACH ROW WHEN ( + new.style_id IS NULL OR new.style_id = 0 +) +BEGIN + SELECT phpbb_styles_seq.nextval + INTO :new.style_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_teampage' +*/ +CREATE TABLE phpbb_teampage ( + teampage_id number(8) NOT NULL, + group_id number(8) DEFAULT '0' NOT NULL, + teampage_name varchar2(765) DEFAULT '' , + teampage_position number(8) DEFAULT '0' NOT NULL, + teampage_parent number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_teampage PRIMARY KEY (teampage_id) +) +/ + + +CREATE SEQUENCE phpbb_teampage_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_teampage +BEFORE INSERT ON phpbb_teampage +FOR EACH ROW WHEN ( + new.teampage_id IS NULL OR new.teampage_id = 0 +) +BEGIN + SELECT phpbb_teampage_seq.nextval + INTO :new.teampage_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE phpbb_topics ( + topic_id number(8) NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + icon_id number(8) DEFAULT '0' NOT NULL, + topic_attachment number(1) DEFAULT '0' NOT NULL, + topic_visibility number(3) DEFAULT '0' NOT NULL, + topic_reported number(1) DEFAULT '0' NOT NULL, + topic_title varchar2(765) DEFAULT '' , + 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_posts_approved number(8) DEFAULT '0' NOT NULL, + topic_posts_unapproved number(8) DEFAULT '0' NOT NULL, + topic_posts_softdeleted 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(765) DEFAULT '' , + topic_first_poster_colour varchar2(6) DEFAULT '' , + 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(765) DEFAULT '' , + topic_last_poster_colour varchar2(6) DEFAULT '' , + topic_last_post_subject varchar2(765) DEFAULT '' , + 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(765) DEFAULT '' , + 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' NOT NULL, + poll_vote_change number(1) DEFAULT '0' NOT NULL, + topic_delete_time number(11) DEFAULT '0' NOT NULL, + topic_delete_reason varchar2(765) DEFAULT '' , + topic_delete_user number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id) +) +/ + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id) +/ +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type) +/ +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time) +/ +CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility) +/ +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id) +/ +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id) +/ + +CREATE SEQUENCE phpbb_topics_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_topics +BEFORE INSERT ON phpbb_topics +FOR EACH ROW WHEN ( + new.topic_id IS NULL OR new.topic_id = 0 +) +BEGIN + SELECT phpbb_topics_seq.nextval + INTO :new.topic_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE phpbb_topics_track ( + 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_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics_track PRIMARY KEY (user_id, topic_id) +) +/ + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id) +/ +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id) +/ + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE phpbb_topics_posted ( + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + topic_posted number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics_posted 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 phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id) +/ +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id) +/ +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status) +/ + +/* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE phpbb_user_notifications ( + item_type varchar2(255) DEFAULT '' , + item_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + method varchar2(255) DEFAULT '' , + notify number(1) DEFAULT '1' NOT NULL +) +/ + + +/* + 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) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id) +/ +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id) +/ +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader) +/ + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE phpbb_users ( + user_id number(8) NOT NULL, + user_type number(2) DEFAULT '0' NOT NULL, + group_id number(8) DEFAULT '3' NOT NULL, + user_permissions clob DEFAULT '' , + user_perm_from number(8) DEFAULT '0' NOT NULL, + user_ip varchar2(40) DEFAULT '' , + user_regdate number(11) DEFAULT '0' NOT NULL, + username varchar2(255) DEFAULT '' , + username_clean varchar2(255) DEFAULT '' , + user_password varchar2(120) DEFAULT '' , + user_passchg number(11) DEFAULT '0' NOT NULL, + user_pass_convert number(1) DEFAULT '0' NOT NULL, + user_email varchar2(300) DEFAULT '' , + user_email_hash number(20) DEFAULT '0' NOT NULL, + user_birthday varchar2(10) DEFAULT '' , + user_lastvisit number(11) DEFAULT '0' NOT NULL, + user_lastmark number(11) DEFAULT '0' NOT NULL, + user_lastpost_time number(11) DEFAULT '0' NOT NULL, + user_lastpage varchar2(600) DEFAULT '' , + user_last_confirm_key varchar2(10) DEFAULT '' , + user_last_search number(11) DEFAULT '0' NOT NULL, + user_warnings number(4) DEFAULT '0' NOT NULL, + user_last_warning number(11) DEFAULT '0' NOT NULL, + user_login_attempts number(4) DEFAULT '0' NOT NULL, + user_inactive_reason number(2) DEFAULT '0' NOT NULL, + user_inactive_time number(11) DEFAULT '0' NOT NULL, + user_posts number(8) DEFAULT '0' NOT NULL, + user_lang varchar2(30) DEFAULT '' , + user_timezone varchar2(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar2(90) DEFAULT 'd M Y H:i' NOT NULL, + user_style number(8) DEFAULT '0' NOT NULL, + user_rank number(8) DEFAULT '0' NOT NULL, + 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 '-3' 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 't' NOT NULL, + user_topic_sortby_dir varchar2(1) DEFAULT 'd' NOT NULL, + user_post_show_days number(4) DEFAULT '0' NOT NULL, + user_post_sortby_type varchar2(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar2(1) DEFAULT 'a' NOT NULL, + 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_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 '230271' NOT NULL, + user_avatar varchar2(255) DEFAULT '' , + user_avatar_type varchar2(255) DEFAULT '' , + 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(8) DEFAULT '' , + user_sig_bbcode_bitfield varchar2(255) DEFAULT '' , + user_from varchar2(300) DEFAULT '' , + user_icq varchar2(15) DEFAULT '' , + user_aim varchar2(765) DEFAULT '' , + user_yim varchar2(765) DEFAULT '' , + user_msnm varchar2(765) DEFAULT '' , + user_jabber varchar2(765) DEFAULT '' , + user_website varchar2(600) DEFAULT '' , + user_occ clob DEFAULT '' , + user_interests clob DEFAULT '' , + user_actkey varchar2(32) DEFAULT '' , + user_newpasswd varchar2(120) DEFAULT '' , + user_form_salt varchar2(96) DEFAULT '' , + user_new number(1) DEFAULT '1' NOT NULL, + user_reminded number(4) DEFAULT '0' NOT NULL, + user_reminded_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), + CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) +) +/ + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) +/ +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) +/ +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) +/ + +CREATE SEQUENCE phpbb_users_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_users +BEFORE INSERT ON phpbb_users +FOR EACH ROW WHEN ( + new.user_id IS NULL OR new.user_id = 0 +) +BEGIN + SELECT phpbb_users_seq.nextval + INTO :new.user_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE phpbb_warnings ( + warning_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + log_id number(8) DEFAULT '0' NOT NULL, + warning_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id) +) +/ + + +CREATE SEQUENCE phpbb_warnings_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_warnings +BEFORE INSERT ON phpbb_warnings +FOR EACH ROW WHEN ( + new.warning_id IS NULL OR new.warning_id = 0 +) +BEGIN + SELECT phpbb_warnings_seq.nextval + INTO :new.warning_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE phpbb_words ( + word_id number(8) NOT NULL, + word varchar2(765) DEFAULT '' , + replacement varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id) +) +/ + + +CREATE SEQUENCE phpbb_words_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_words +BEFORE INSERT ON phpbb_words +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) +BEGIN + SELECT phpbb_words_seq.nextval + INTO :new.word_id + FROM dual; +END; +/ + + +/* + 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, + CONSTRAINT pk_phpbb_zebra PRIMARY KEY (user_id, zebra_id) +) +/ + + +/* + Table: 'phpbb_gallery_albums' +*/ +CREATE TABLE phpbb_gallery_albums ( + album_id number(8) NOT NULL, + parent_id number(8) DEFAULT '0' NOT NULL, + left_id number(8) DEFAULT '1' NOT NULL, + right_id number(8) DEFAULT '2' NOT NULL, + album_parents clob DEFAULT '' , + album_type number(3) DEFAULT '1' NOT NULL, + album_status number(1) DEFAULT '1' NOT NULL, + album_contest number(8) DEFAULT '0' NOT NULL, + album_name varchar2(255) DEFAULT '' , + album_desc clob DEFAULT '' , + album_desc_options number(3) DEFAULT '7' NOT NULL, + album_desc_uid varchar2(8) DEFAULT '' , + album_desc_bitfield varchar2(255) DEFAULT '' , + album_user_id number(8) DEFAULT '0' NOT NULL, + album_images number(8) DEFAULT '0' NOT NULL, + album_images_real number(8) DEFAULT '0' NOT NULL, + album_last_image_id number(8) DEFAULT '0' NOT NULL, + album_image varchar2(255) DEFAULT '' , + album_last_image_time number(11) DEFAULT '0' NOT NULL, + album_last_image_name varchar2(255) DEFAULT '' , + album_last_username varchar2(255) DEFAULT '' , + album_last_user_colour varchar2(6) DEFAULT '' , + album_last_user_id number(8) DEFAULT '0' NOT NULL, + album_watermark number(1) DEFAULT '1' NOT NULL, + album_sort_key varchar2(8) DEFAULT '' , + album_sort_dir varchar2(8) DEFAULT '' , + display_in_rrc number(1) DEFAULT '1' NOT NULL, + display_on_index number(1) DEFAULT '1' NOT NULL, + display_subalbum_list number(1) DEFAULT '1' NOT NULL, + album_feed number(1) DEFAULT '1' NOT NULL, + album_auth_access number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_albums PRIMARY KEY (album_id) +) +/ + + +CREATE SEQUENCE phpbb_gallery_albums_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_albums +BEFORE INSERT ON phpbb_gallery_albums +FOR EACH ROW WHEN ( + new.album_id IS NULL OR new.album_id = 0 +) +BEGIN + SELECT phpbb_gallery_albums_seq.nextval + INTO :new.album_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_albums_track' +*/ +CREATE TABLE phpbb_gallery_albums_track ( + user_id number(8) DEFAULT '0' NOT NULL, + album_id number(8) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_albums_track PRIMARY KEY (user_id, album_id) +) +/ + + +/* + Table: 'phpbb_gallery_comments' +*/ +CREATE TABLE phpbb_gallery_comments ( + comment_id number(8) NOT NULL, + comment_image_id number(8) NOT NULL, + comment_user_id number(8) DEFAULT '0' NOT NULL, + comment_username varchar2(255) DEFAULT '' , + comment_user_colour varchar2(6) DEFAULT '' , + comment_user_ip varchar2(40) DEFAULT '' , + comment_signature number(1) DEFAULT '0' NOT NULL, + comment_time number(11) DEFAULT '0' NOT NULL, + comment clob DEFAULT '' , + comment_uid varchar2(8) DEFAULT '' , + comment_bitfield varchar2(255) DEFAULT '' , + comment_edit_time number(11) DEFAULT '0' NOT NULL, + comment_edit_count number(4) DEFAULT '0' NOT NULL, + comment_edit_user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_comments PRIMARY KEY (comment_id) +) +/ + +CREATE INDEX phpbb_gallery_comments_id ON phpbb_gallery_comments (comment_image_id) +/ +CREATE INDEX phpbb_gallery_comments_uid ON phpbb_gallery_comments (comment_user_id) +/ +CREATE INDEX phpbb_gallery_comments_ip ON phpbb_gallery_comments (comment_user_ip) +/ +CREATE INDEX phpbb_gallery_comments_time ON phpbb_gallery_comments (comment_time) +/ + +CREATE SEQUENCE phpbb_gallery_comments_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_comments +BEFORE INSERT ON phpbb_gallery_comments +FOR EACH ROW WHEN ( + new.comment_id IS NULL OR new.comment_id = 0 +) +BEGIN + SELECT phpbb_gallery_comments_seq.nextval + INTO :new.comment_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_contests' +*/ +CREATE TABLE phpbb_gallery_contests ( + contest_id number(8) NOT NULL, + contest_album_id number(8) DEFAULT '0' NOT NULL, + contest_start number(11) DEFAULT '0' NOT NULL, + contest_rating number(11) DEFAULT '0' NOT NULL, + contest_end number(11) DEFAULT '0' NOT NULL, + contest_marked number(1) DEFAULT '0' NOT NULL, + contest_first number(8) DEFAULT '0' NOT NULL, + contest_second number(8) DEFAULT '0' NOT NULL, + contest_third number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_contests PRIMARY KEY (contest_id) +) +/ + + +CREATE SEQUENCE phpbb_gallery_contests_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_contests +BEFORE INSERT ON phpbb_gallery_contests +FOR EACH ROW WHEN ( + new.contest_id IS NULL OR new.contest_id = 0 +) +BEGIN + SELECT phpbb_gallery_contests_seq.nextval + INTO :new.contest_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_favorites' +*/ +CREATE TABLE phpbb_gallery_favorites ( + favorite_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + image_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_favorites PRIMARY KEY (favorite_id) +) +/ + +CREATE INDEX phpbb_gallery_favorites_uid ON phpbb_gallery_favorites (user_id) +/ +CREATE INDEX phpbb_gallery_favorites_id ON phpbb_gallery_favorites (image_id) +/ + +CREATE SEQUENCE phpbb_gallery_favorites_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_favorites +BEFORE INSERT ON phpbb_gallery_favorites +FOR EACH ROW WHEN ( + new.favorite_id IS NULL OR new.favorite_id = 0 +) +BEGIN + SELECT phpbb_gallery_favorites_seq.nextval + INTO :new.favorite_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_images' +*/ +CREATE TABLE phpbb_gallery_images ( + image_id number(8) NOT NULL, + image_filename varchar2(255) DEFAULT '' , + image_name varchar2(255) DEFAULT '' , + image_name_clean varchar2(255) DEFAULT '' , + image_desc clob DEFAULT '' , + image_desc_uid varchar2(8) DEFAULT '' , + image_desc_bitfield varchar2(255) DEFAULT '' , + image_user_id number(8) DEFAULT '0' NOT NULL, + image_username varchar2(255) DEFAULT '' , + image_username_clean varchar2(255) DEFAULT '' , + image_user_colour varchar2(6) DEFAULT '' , + image_user_ip varchar2(40) DEFAULT '' , + image_time number(11) DEFAULT '0' NOT NULL, + image_album_id number(8) DEFAULT '0' NOT NULL, + image_view_count number(11) DEFAULT '0' NOT NULL, + image_status number(3) DEFAULT '0' NOT NULL, + image_contest number(1) DEFAULT '0' NOT NULL, + image_contest_end number(11) DEFAULT '0' NOT NULL, + image_contest_rank number(3) DEFAULT '0' NOT NULL, + image_filemissing number(3) DEFAULT '0' NOT NULL, + image_has_exif number(3) DEFAULT '2' NOT NULL, + image_exif_data clob DEFAULT '' , + image_rates number(8) DEFAULT '0' NOT NULL, + image_rate_points number(8) DEFAULT '0' NOT NULL, + image_rate_avg number(8) DEFAULT '0' NOT NULL, + image_comments number(8) DEFAULT '0' NOT NULL, + image_last_comment number(8) DEFAULT '0' NOT NULL, + image_allow_comments number(1) DEFAULT '1' NOT NULL, + image_favorited number(8) DEFAULT '0' NOT NULL, + image_reported number(8) DEFAULT '0' NOT NULL, + filesize_upload number(20) DEFAULT '0' NOT NULL, + filesize_medium number(20) DEFAULT '0' NOT NULL, + filesize_cache number(20) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_images PRIMARY KEY (image_id) +) +/ + +CREATE INDEX phpbb_gallery_images_aid ON phpbb_gallery_images (image_album_id) +/ +CREATE INDEX phpbb_gallery_images_uid ON phpbb_gallery_images (image_user_id) +/ +CREATE INDEX phpbb_gallery_images_time ON phpbb_gallery_images (image_time) +/ + +CREATE SEQUENCE phpbb_gallery_images_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_images +BEFORE INSERT ON phpbb_gallery_images +FOR EACH ROW WHEN ( + new.image_id IS NULL OR new.image_id = 0 +) +BEGIN + SELECT phpbb_gallery_images_seq.nextval + INTO :new.image_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_modscache' +*/ +CREATE TABLE phpbb_gallery_modscache ( + album_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(255) DEFAULT '' , + group_id number(8) DEFAULT '0' NOT NULL, + group_name varchar2(255) DEFAULT '' , + display_on_index number(1) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX phpbb_gallery_modscache_doi ON phpbb_gallery_modscache (display_on_index) +/ +CREATE INDEX phpbb_gallery_modscache_aid ON phpbb_gallery_modscache (album_id) +/ + +/* + Table: 'phpbb_gallery_permissions' +*/ +CREATE TABLE phpbb_gallery_permissions ( + perm_id number(8) NOT NULL, + perm_role_id number(8) DEFAULT '0' NOT NULL, + perm_album_id number(8) DEFAULT '0' NOT NULL, + perm_user_id number(8) DEFAULT '0' NOT NULL, + perm_group_id number(8) DEFAULT '0' NOT NULL, + perm_system number(3) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_permissions PRIMARY KEY (perm_id) +) +/ + + +CREATE SEQUENCE phpbb_gallery_permissions_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_permissions +BEFORE INSERT ON phpbb_gallery_permissions +FOR EACH ROW WHEN ( + new.perm_id IS NULL OR new.perm_id = 0 +) +BEGIN + SELECT phpbb_gallery_permissions_seq.nextval + INTO :new.perm_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_rates' +*/ +CREATE TABLE phpbb_gallery_rates ( + rate_image_id number(8) DEFAULT '0' NOT NULL, + rate_user_id number(8) DEFAULT '0' NOT NULL, + rate_user_ip varchar2(40) DEFAULT '' , + rate_point number(3) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_rates PRIMARY KEY (rate_image_id, rate_user_id) +) +/ + + +/* + Table: 'phpbb_gallery_reports' +*/ +CREATE TABLE phpbb_gallery_reports ( + report_id number(8) NOT NULL, + report_album_id number(8) DEFAULT '0' NOT NULL, + report_image_id number(8) DEFAULT '0' NOT NULL, + reporter_id number(8) DEFAULT '0' NOT NULL, + report_manager number(8) DEFAULT '0' NOT NULL, + report_note clob DEFAULT '' , + report_time number(11) DEFAULT '0' NOT NULL, + report_status number(3) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_reports PRIMARY KEY (report_id) +) +/ + + +CREATE SEQUENCE phpbb_gallery_reports_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_reports +BEFORE INSERT ON phpbb_gallery_reports +FOR EACH ROW WHEN ( + new.report_id IS NULL OR new.report_id = 0 +) +BEGIN + SELECT phpbb_gallery_reports_seq.nextval + INTO :new.report_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_roles' +*/ +CREATE TABLE phpbb_gallery_roles ( + role_id number(8) NOT NULL, + a_list number(3) DEFAULT '0' NOT NULL, + i_view number(3) DEFAULT '0' NOT NULL, + i_watermark number(3) DEFAULT '0' NOT NULL, + i_upload number(3) DEFAULT '0' NOT NULL, + i_edit number(3) DEFAULT '0' NOT NULL, + i_delete number(3) DEFAULT '0' NOT NULL, + i_rate number(3) DEFAULT '0' NOT NULL, + i_approve number(3) DEFAULT '0' NOT NULL, + i_lock number(3) DEFAULT '0' NOT NULL, + i_report number(3) DEFAULT '0' NOT NULL, + i_count number(8) DEFAULT '0' NOT NULL, + i_unlimited number(3) DEFAULT '0' NOT NULL, + c_read number(3) DEFAULT '0' NOT NULL, + c_post number(3) DEFAULT '0' NOT NULL, + c_edit number(3) DEFAULT '0' NOT NULL, + c_delete number(3) DEFAULT '0' NOT NULL, + m_comments number(3) DEFAULT '0' NOT NULL, + m_delete number(3) DEFAULT '0' NOT NULL, + m_edit number(3) DEFAULT '0' NOT NULL, + m_move number(3) DEFAULT '0' NOT NULL, + m_report number(3) DEFAULT '0' NOT NULL, + m_status number(3) DEFAULT '0' NOT NULL, + a_count number(8) DEFAULT '0' NOT NULL, + a_unlimited number(3) DEFAULT '0' NOT NULL, + a_restrict number(3) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_roles PRIMARY KEY (role_id) +) +/ + + +CREATE SEQUENCE phpbb_gallery_roles_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_roles +BEFORE INSERT ON phpbb_gallery_roles +FOR EACH ROW WHEN ( + new.role_id IS NULL OR new.role_id = 0 +) +BEGIN + SELECT phpbb_gallery_roles_seq.nextval + INTO :new.role_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_gallery_users' +*/ +CREATE TABLE phpbb_gallery_users ( + user_id number(8) DEFAULT '0' NOT NULL, + watch_own number(3) DEFAULT '0' NOT NULL, + watch_favo number(3) DEFAULT '0' NOT NULL, + watch_com number(3) DEFAULT '0' NOT NULL, + user_images number(8) DEFAULT '0' NOT NULL, + personal_album_id number(8) DEFAULT '0' NOT NULL, + user_lastmark number(11) DEFAULT '0' NOT NULL, + user_last_update number(11) DEFAULT '0' NOT NULL, + user_viewexif number(1) DEFAULT '0' NOT NULL, + user_permissions clob DEFAULT '' , + user_permissions_changed number(11) DEFAULT '0' NOT NULL, + user_allow_comments number(1) DEFAULT '1' NOT NULL, + subscribe_pegas number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_users PRIMARY KEY (user_id) +) +/ + +CREATE INDEX phpbb_gallery_users_pega ON phpbb_gallery_users (personal_album_id) +/ + +/* + Table: 'phpbb_gallery_watch' +*/ +CREATE TABLE phpbb_gallery_watch ( + watch_id number(8) NOT NULL, + album_id number(8) DEFAULT '0' NOT NULL, + image_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_gallery_watch PRIMARY KEY (watch_id) +) +/ + +CREATE INDEX phpbb_gallery_watch_uid ON phpbb_gallery_watch (user_id) +/ +CREATE INDEX phpbb_gallery_watch_id ON phpbb_gallery_watch (image_id) +/ +CREATE INDEX phpbb_gallery_watch_aid ON phpbb_gallery_watch (album_id) +/ + +CREATE SEQUENCE phpbb_gallery_watch_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_gallery_watch +BEFORE INSERT ON phpbb_gallery_watch +FOR EACH ROW WHEN ( + new.watch_id IS NULL OR new.watch_id = 0 +) +BEGIN + SELECT phpbb_gallery_watch_seq.nextval + INTO :new.watch_id + FROM dual; +END; +/ + + diff --git a/tests/schemas/postgres_schema.sql b/tests/schemas/postgres_schema.sql new file mode 100644 index 00000000..1c940534 --- /dev/null +++ b/tests/schemas/postgres_schema.sql @@ -0,0 +1,1664 @@ +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +BEGIN; + +/* + Domain definition +*/ +CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying; + +/* + Operation Functions +*/ +CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; + +/* + Operators +*/ +CREATE OPERATOR <( + PROCEDURE = _varchar_ci_less_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR <=( + PROCEDURE = _varchar_ci_less_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR >( + PROCEDURE = _varchar_ci_greater_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR >=( + PROCEDURE = _varchar_ci_greater_equals, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR <>( + PROCEDURE = _varchar_ci_not_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = neqsel, + JOIN = neqjoinsel); + +CREATE OPERATOR =( + PROCEDURE = _varchar_ci_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel, + HASHES, + MERGES, + SORT1= <); + +/* + Table: 'phpbb_attachments' +*/ +CREATE SEQUENCE phpbb_attachments_seq; + +CREATE TABLE phpbb_attachments ( + attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'), + post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0), + poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), + is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0), + physical_filename varchar(255) DEFAULT '' NOT NULL, + real_filename varchar(255) DEFAULT '' NOT NULL, + download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0), + attach_comment varchar(4000) DEFAULT '' NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + mimetype varchar(100) DEFAULT '' NOT NULL, + filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0), + filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0), + thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0), + PRIMARY KEY (attach_id) +); + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE phpbb_acl_groups ( + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); + +/* + Table: 'phpbb_acl_options' +*/ +CREATE SEQUENCE phpbb_acl_options_seq; + +CREATE TABLE phpbb_acl_options ( + auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'), + auth_option varchar(50) DEFAULT '' NOT NULL, + is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0), + is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0), + founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0), + PRIMARY KEY (auth_option_id) +); + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE SEQUENCE phpbb_acl_roles_seq; + +CREATE TABLE phpbb_acl_roles ( + role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'), + role_name varchar(255) DEFAULT '' NOT NULL, + role_description varchar(4000) DEFAULT '' NOT NULL, + role_type varchar(10) DEFAULT '' NOT NULL, + role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0), + PRIMARY KEY (role_id) +); + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE phpbb_acl_roles_data ( + role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id) +); + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE phpbb_acl_users ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); + +/* + Table: 'phpbb_banlist' +*/ +CREATE SEQUENCE phpbb_banlist_seq; + +CREATE TABLE phpbb_banlist ( + ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'), + ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0), + ban_ip varchar(40) DEFAULT '' NOT NULL, + ban_email varchar(100) DEFAULT '' NOT NULL, + ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0), + ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0), + ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0), + ban_reason varchar(255) DEFAULT '' NOT NULL, + ban_give_reason varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (ban_id) +); + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0), + bbcode_tag varchar(16) DEFAULT '' NOT NULL, + bbcode_helpline varchar(255) DEFAULT '' NOT NULL, + display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0), + bbcode_match varchar(4000) DEFAULT '' NOT NULL, + bbcode_tpl TEXT DEFAULT '' NOT NULL, + first_pass_match TEXT DEFAULT '' NOT NULL, + first_pass_replace TEXT DEFAULT '' NOT NULL, + second_pass_match TEXT DEFAULT '' NOT NULL, + second_pass_replace TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (bbcode_id) +); + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + PRIMARY KEY (topic_id, user_id) +); + + +/* + Table: 'phpbb_bots' +*/ +CREATE SEQUENCE phpbb_bots_seq; + +CREATE TABLE phpbb_bots ( + bot_id INT4 DEFAULT nextval('phpbb_bots_seq'), + bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0), + bot_name varchar(255) DEFAULT '' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + bot_agent varchar(255) DEFAULT '' NOT NULL, + bot_ip varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id) +); + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE phpbb_config ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0), + PRIMARY KEY (config_name) +); + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); + +/* + Table: 'phpbb_config_text' +*/ +CREATE TABLE phpbb_config_text ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (config_name) +); + + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + confirm_type INT2 DEFAULT '0' NOT NULL, + code varchar(8) DEFAULT '' NOT NULL, + seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0), + attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0), + PRIMARY KEY (session_id, confirm_id) +); + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); + +/* + Table: 'phpbb_disallow' +*/ +CREATE SEQUENCE phpbb_disallow_seq; + +CREATE TABLE phpbb_disallow ( + disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'), + disallow_username varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (disallow_id) +); + + +/* + Table: 'phpbb_drafts' +*/ +CREATE SEQUENCE phpbb_drafts_seq; + +CREATE TABLE phpbb_drafts ( + draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0), + draft_subject varchar(255) DEFAULT '' NOT NULL, + draft_message TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (draft_id) +); + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0), + ext_state varchar(8000) DEFAULT '' NOT NULL +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); + +/* + Table: 'phpbb_extensions' +*/ +CREATE SEQUENCE phpbb_extensions_seq; + +CREATE TABLE phpbb_extensions ( + extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'), + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + extension varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +); + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE SEQUENCE phpbb_extension_groups_seq; + +CREATE TABLE phpbb_extension_groups ( + group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'), + group_name varchar(255) DEFAULT '' NOT NULL, + cat_id INT2 DEFAULT '0' NOT NULL, + allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0), + download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0), + upload_icon varchar(255) DEFAULT '' NOT NULL, + max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0), + allowed_forums varchar(8000) DEFAULT '' NOT NULL, + allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0), + PRIMARY KEY (group_id) +); + + +/* + Table: 'phpbb_forums' +*/ +CREATE SEQUENCE phpbb_forums_seq; + +CREATE TABLE phpbb_forums ( + forum_id INT4 DEFAULT nextval('phpbb_forums_seq'), + parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), + left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), + right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), + forum_parents TEXT DEFAULT '' NOT NULL, + forum_name varchar(255) DEFAULT '' NOT NULL, + forum_desc varchar(4000) DEFAULT '' NOT NULL, + forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0), + forum_desc_uid varchar(8) DEFAULT '' NOT NULL, + forum_link varchar(255) DEFAULT '' NOT NULL, + forum_password varchar(40) DEFAULT '' NOT NULL, + forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0), + forum_image varchar(255) DEFAULT '' NOT NULL, + forum_rules varchar(4000) DEFAULT '' NOT NULL, + forum_rules_link varchar(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0), + forum_rules_uid varchar(8) DEFAULT '' NOT NULL, + forum_topics_per_page INT2 DEFAULT '0' NOT NULL, + forum_type INT2 DEFAULT '0' NOT NULL, + forum_status INT2 DEFAULT '0' NOT NULL, + forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0), + forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0), + forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0), + forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0), + forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0), + forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0), + forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), + forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), + forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, + forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), + forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + forum_flags INT2 DEFAULT '32' NOT NULL, + forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0), + display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0), + display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), + enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), + enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0), + enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0), + prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0), + prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0), + prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0), + prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0), + PRIMARY KEY (forum_id) +); + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE phpbb_forums_access ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + session_id char(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +); + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE phpbb_forums_track ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), + PRIMARY KEY (user_id, forum_id) +); + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE phpbb_forums_watch ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) +); + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); + +/* + Table: 'phpbb_groups' +*/ +CREATE SEQUENCE phpbb_groups_seq; + +CREATE TABLE phpbb_groups ( + group_id INT4 DEFAULT nextval('phpbb_groups_seq'), + group_type INT2 DEFAULT '1' NOT NULL, + group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0), + group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0), + group_name varchar_ci DEFAULT '' NOT NULL, + group_desc varchar(4000) DEFAULT '' NOT NULL, + group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0), + group_desc_uid varchar(8) DEFAULT '' NOT NULL, + group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), + group_avatar varchar(255) DEFAULT '' NOT NULL, + group_avatar_type varchar(255) DEFAULT '' NOT NULL, + group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0), + group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0), + group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0), + group_colour varchar(6) DEFAULT '' NOT NULL, + group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0), + group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0), + group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0), + group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0), + group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), + PRIMARY KEY (group_id) +); + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); + +/* + Table: 'phpbb_icons' +*/ +CREATE SEQUENCE phpbb_icons_seq; + +CREATE TABLE phpbb_icons ( + icons_id INT4 DEFAULT nextval('phpbb_icons_seq'), + icons_url varchar(255) DEFAULT '' NOT NULL, + icons_width INT2 DEFAULT '0' NOT NULL, + icons_height INT2 DEFAULT '0' NOT NULL, + icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0), + display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), + PRIMARY KEY (icons_id) +); + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); + +/* + Table: 'phpbb_lang' +*/ +CREATE SEQUENCE phpbb_lang_seq; + +CREATE TABLE phpbb_lang ( + lang_id INT2 DEFAULT nextval('phpbb_lang_seq'), + lang_iso varchar(30) DEFAULT '' NOT NULL, + lang_dir varchar(30) DEFAULT '' NOT NULL, + lang_english_name varchar(100) DEFAULT '' NOT NULL, + lang_local_name varchar(255) DEFAULT '' NOT NULL, + lang_author varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (lang_id) +); + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); + +/* + Table: 'phpbb_log' +*/ +CREATE SEQUENCE phpbb_log_seq; + +CREATE TABLE phpbb_log ( + log_id INT4 DEFAULT nextval('phpbb_log_seq'), + log_type INT2 DEFAULT '0' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0), + log_ip varchar(40) DEFAULT '' NOT NULL, + log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0), + log_operation varchar(4000) DEFAULT '' NOT NULL, + log_data TEXT DEFAULT '' NOT NULL, + album_id INT4 DEFAULT '0' NOT NULL CHECK (album_id >= 0), + image_id INT4 DEFAULT '0' NOT NULL CHECK (image_id >= 0), + PRIMARY KEY (log_id) +); + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) DEFAULT '' NOT NULL, + attempt_browser varchar(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, + attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + username varchar(255) DEFAULT '0' NOT NULL, + username_clean varchar_ci DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + username varchar(255) DEFAULT '' NOT NULL, + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0) +); + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); + +/* + Table: 'phpbb_migrations' +*/ +CREATE TABLE phpbb_migrations ( + migration_name varchar(255) DEFAULT '' NOT NULL, + migration_depends_on varchar(8000) DEFAULT '' NOT NULL, + migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0), + migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0), + migration_data_state varchar(8000) DEFAULT '' NOT NULL, + migration_start_time INT4 DEFAULT '0' NOT NULL CHECK (migration_start_time >= 0), + migration_end_time INT4 DEFAULT '0' NOT NULL CHECK (migration_end_time >= 0), + PRIMARY KEY (migration_name) +); + + +/* + Table: 'phpbb_modules' +*/ +CREATE SEQUENCE phpbb_modules_seq; + +CREATE TABLE phpbb_modules ( + module_id INT4 DEFAULT nextval('phpbb_modules_seq'), + module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0), + module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0), + module_basename varchar(255) DEFAULT '' NOT NULL, + module_class varchar(10) DEFAULT '' NOT NULL, + parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), + left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), + right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), + module_langname varchar(255) DEFAULT '' NOT NULL, + module_mode varchar(255) DEFAULT '' NOT NULL, + module_auth varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id) +); + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); + +/* + Table: 'phpbb_notification_types' +*/ +CREATE SEQUENCE phpbb_notification_types_seq; + +CREATE TABLE phpbb_notification_types ( + notification_type_id INT2 DEFAULT nextval('phpbb_notification_types_seq'), + notification_type_name varchar(255) DEFAULT '' NOT NULL, + notification_type_enabled INT2 DEFAULT '1' NOT NULL CHECK (notification_type_enabled >= 0), + PRIMARY KEY (notification_type_id) +); + +CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name); + +/* + Table: 'phpbb_notifications' +*/ +CREATE SEQUENCE phpbb_notifications_seq; + +CREATE TABLE phpbb_notifications ( + notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'), + notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0), + item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), + item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + notification_read INT2 DEFAULT '0' NOT NULL CHECK (notification_read >= 0), + notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0), + notification_data varchar(4000) DEFAULT '' NOT NULL, + PRIMARY KEY (notification_id) +); + +CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id); +CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read); + +/* + Table: 'phpbb_oauth_accounts' +*/ +CREATE TABLE phpbb_oauth_accounts ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + provider varchar(255) DEFAULT '' NOT NULL, + oauth_provider_id varchar(4000) DEFAULT '' NOT NULL, + PRIMARY KEY (user_id, provider) +); + + +/* + Table: 'phpbb_oauth_tokens' +*/ +CREATE TABLE phpbb_oauth_tokens ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + session_id char(32) DEFAULT '' NOT NULL, + provider varchar(255) DEFAULT '' NOT NULL, + oauth_token TEXT DEFAULT '' NOT NULL +); + +CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id); +CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider); + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE phpbb_poll_options ( + poll_option_id INT2 DEFAULT '0' NOT NULL, + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + poll_option_text varchar(4000) DEFAULT '' NOT NULL, + poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0) +); + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE phpbb_poll_votes ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + poll_option_id INT2 DEFAULT '0' NOT NULL, + vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0), + vote_user_ip varchar(40) DEFAULT '' NOT NULL +); + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); + +/* + Table: 'phpbb_posts' +*/ +CREATE SEQUENCE phpbb_posts_seq; + +CREATE TABLE phpbb_posts ( + post_id INT4 DEFAULT nextval('phpbb_posts_seq'), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + poster_ip varchar(40) DEFAULT '' NOT NULL, + post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0), + post_visibility INT2 DEFAULT '0' NOT NULL, + post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0), + enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), + enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), + enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), + enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), + post_username varchar(255) DEFAULT '' NOT NULL, + post_subject varchar(255) DEFAULT '' NOT NULL, + post_text TEXT DEFAULT '' NOT NULL, + post_checksum varchar(32) DEFAULT '' NOT NULL, + post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0), + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0), + post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), + post_edit_reason varchar(255) DEFAULT '' NOT NULL, + post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0), + post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0), + post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0), + post_delete_time INT4 DEFAULT '0' NOT NULL CHECK (post_delete_time >= 0), + post_delete_reason varchar(255) DEFAULT '' NOT NULL, + post_delete_user INT4 DEFAULT '0' NOT NULL CHECK (post_delete_user >= 0), + PRIMARY KEY (post_id) +); + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); +CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE SEQUENCE phpbb_privmsgs_seq; + +CREATE TABLE phpbb_privmsgs ( + msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'), + root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0), + author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + author_ip varchar(40) DEFAULT '' NOT NULL, + message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0), + enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), + enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), + enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), + enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), + message_subject varchar(255) DEFAULT '' NOT NULL, + message_text TEXT DEFAULT '' NOT NULL, + message_edit_reason varchar(255) DEFAULT '' NOT NULL, + message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0), + message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0), + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0), + message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), + to_address varchar(4000) DEFAULT '' NOT NULL, + bcc_address varchar(4000) DEFAULT '' NOT NULL, + message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0), + PRIMARY KEY (msg_id) +); + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE SEQUENCE phpbb_privmsgs_folder_seq; + +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + folder_name varchar(255) DEFAULT '' NOT NULL, + pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0), + PRIMARY KEY (folder_id) +); + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE SEQUENCE phpbb_privmsgs_rules_seq; + +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0), + rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0), + rule_string varchar(255) DEFAULT '' NOT NULL, + rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0), + rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0), + rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0), + rule_folder_id INT4 DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id) +); + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE phpbb_privmsgs_to ( + msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), + pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0), + pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0), + pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0), + pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0), + pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0), + pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0), + folder_id INT4 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE SEQUENCE phpbb_profile_fields_seq; + +CREATE TABLE phpbb_profile_fields ( + field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'), + field_name varchar(255) DEFAULT '' NOT NULL, + field_type INT2 DEFAULT '0' NOT NULL, + field_ident varchar(20) DEFAULT '' NOT NULL, + field_length varchar(20) DEFAULT '' NOT NULL, + field_minlen varchar(255) DEFAULT '' NOT NULL, + field_maxlen varchar(255) DEFAULT '' NOT NULL, + field_novalue varchar(255) DEFAULT '' NOT NULL, + field_default_value varchar(255) DEFAULT '' NOT NULL, + field_validation varchar(20) DEFAULT '' NOT NULL, + field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), + field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0), + field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), + field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0), + field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0), + field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), + field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), + field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), + field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0), + field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0), + PRIMARY KEY (field_id) +); + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE phpbb_profile_fields_data ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + PRIMARY KEY (user_id) +); + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE phpbb_profile_fields_lang ( + field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), + lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), + option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0), + field_type INT2 DEFAULT '0' NOT NULL, + lang_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +); + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE phpbb_profile_lang ( + field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), + lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), + lang_name varchar(255) DEFAULT '' NOT NULL, + lang_explain varchar(4000) DEFAULT '' NOT NULL, + lang_default_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id) +); + + +/* + Table: 'phpbb_ranks' +*/ +CREATE SEQUENCE phpbb_ranks_seq; + +CREATE TABLE phpbb_ranks ( + rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'), + rank_title varchar(255) DEFAULT '' NOT NULL, + rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0), + rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0), + rank_image varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +); + + +/* + Table: 'phpbb_reports' +*/ +CREATE SEQUENCE phpbb_reports_seq; + +CREATE TABLE phpbb_reports ( + report_id INT4 DEFAULT nextval('phpbb_reports_seq'), + reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0), + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), + report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), + report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), + report_text TEXT DEFAULT '' NOT NULL, + reported_post_text TEXT DEFAULT '' NOT NULL, + reported_post_uid varchar(8) DEFAULT '' NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, + reported_post_enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_magic_url >= 0), + reported_post_enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_smilies >= 0), + reported_post_enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_bbcode >= 0), + PRIMARY KEY (report_id) +); + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE SEQUENCE phpbb_reports_reasons_seq; + +CREATE TABLE phpbb_reports_reasons ( + reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'), + reason_title varchar(255) DEFAULT '' NOT NULL, + reason_description TEXT DEFAULT '' NOT NULL, + reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0), + PRIMARY KEY (reason_id) +); + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE phpbb_search_results ( + search_key varchar(32) DEFAULT '' NOT NULL, + search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0), + search_keywords TEXT DEFAULT '' NOT NULL, + search_authors TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (search_key) +); + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE SEQUENCE phpbb_search_wordlist_seq; + +CREATE TABLE phpbb_search_wordlist ( + word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'), + word_text varchar(255) DEFAULT '' NOT NULL, + word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0), + word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0), + PRIMARY KEY (word_id) +); + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE phpbb_search_wordmatch ( + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0), + title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0) +); + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' NOT NULL, + session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0), + session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0), + session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0), + session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0), + session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0), + session_ip varchar(40) DEFAULT '' NOT NULL, + session_browser varchar(150) DEFAULT '' NOT NULL, + session_forwarded_for varchar(255) DEFAULT '' NOT NULL, + session_page varchar(255) DEFAULT '' NOT NULL, + session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0), + session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0), + session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0), + session_album_id INT4 DEFAULT '0' NOT NULL CHECK (session_album_id >= 0), + PRIMARY KEY (session_id) +); + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); +CREATE INDEX phpbb_sessions_session_aid ON phpbb_sessions (session_album_id); + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + last_ip varchar(40) DEFAULT '' NOT NULL, + last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0), + PRIMARY KEY (key_id, user_id) +); + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); + +/* + Table: 'phpbb_sitelist' +*/ +CREATE SEQUENCE phpbb_sitelist_seq; + +CREATE TABLE phpbb_sitelist ( + site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'), + site_ip varchar(40) DEFAULT '' NOT NULL, + site_hostname varchar(255) DEFAULT '' NOT NULL, + ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0), + PRIMARY KEY (site_id) +); + + +/* + Table: 'phpbb_smilies' +*/ +CREATE SEQUENCE phpbb_smilies_seq; + +CREATE TABLE phpbb_smilies ( + smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'), + code varchar(50) DEFAULT '' NOT NULL, + emotion varchar(50) DEFAULT '' NOT NULL, + smiley_url varchar(50) DEFAULT '' NOT NULL, + smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0), + smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0), + smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0), + display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), + PRIMARY KEY (smiley_id) +); + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); + +/* + Table: 'phpbb_styles' +*/ +CREATE SEQUENCE phpbb_styles_seq; + +CREATE TABLE phpbb_styles ( + style_id INT4 DEFAULT nextval('phpbb_styles_seq'), + style_name varchar(255) DEFAULT '' NOT NULL, + style_copyright varchar(255) DEFAULT '' NOT NULL, + style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0), + style_path varchar(100) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0), + style_parent_tree varchar(8000) DEFAULT '' NOT NULL, + PRIMARY KEY (style_id) +); + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); + +/* + Table: 'phpbb_teampage' +*/ +CREATE SEQUENCE phpbb_teampage_seq; + +CREATE TABLE phpbb_teampage ( + teampage_id INT4 DEFAULT nextval('phpbb_teampage_seq'), + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + teampage_name varchar(255) DEFAULT '' NOT NULL, + teampage_position INT4 DEFAULT '0' NOT NULL CHECK (teampage_position >= 0), + teampage_parent INT4 DEFAULT '0' NOT NULL CHECK (teampage_parent >= 0), + PRIMARY KEY (teampage_id) +); + + +/* + Table: 'phpbb_topics' +*/ +CREATE SEQUENCE phpbb_topics_seq; + +CREATE TABLE phpbb_topics ( + topic_id INT4 DEFAULT nextval('phpbb_topics_seq'), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0), + topic_visibility INT2 DEFAULT '0' NOT NULL, + topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0), + topic_title varchar(255) DEFAULT '' NOT NULL, + topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0), + topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), + topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), + topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), + topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0), + topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0), + topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0), + topic_status INT2 DEFAULT '0' NOT NULL, + topic_type INT2 DEFAULT '0' NOT NULL, + topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), + topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0), + topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), + topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, + topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), + topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), + topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), + topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0), + topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0), + poll_title varchar(255) DEFAULT '' NOT NULL, + poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0), + poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0), + poll_max_options INT2 DEFAULT '1' NOT NULL, + poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0), + poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0), + topic_delete_time INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_time >= 0), + topic_delete_reason varchar(255) DEFAULT '' NOT NULL, + topic_delete_user INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_user >= 0), + PRIMARY KEY (topic_id) +); + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); +CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility); +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id); +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE phpbb_topics_track ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), + PRIMARY KEY (user_id, topic_id) +); + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE phpbb_topics_posted ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0), + PRIMARY KEY (user_id, topic_id) +); + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE phpbb_topics_watch ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) +); + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); + +/* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) DEFAULT '' NOT NULL, + item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + method varchar(255) DEFAULT '' NOT NULL, + notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0) +); + + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE phpbb_user_group ( + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0), + user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0) +); + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); + +/* + Table: 'phpbb_users' +*/ +CREATE SEQUENCE phpbb_users_seq; + +CREATE TABLE phpbb_users ( + user_id INT4 DEFAULT nextval('phpbb_users_seq'), + user_type INT2 DEFAULT '0' NOT NULL, + group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0), + user_permissions TEXT DEFAULT '' NOT NULL, + user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0), + user_ip varchar(40) DEFAULT '' NOT NULL, + user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0), + username varchar_ci DEFAULT '' NOT NULL, + username_clean varchar_ci DEFAULT '' NOT NULL, + user_password varchar(40) DEFAULT '' NOT NULL, + user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0), + user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0), + user_email varchar(100) DEFAULT '' NOT NULL, + user_email_hash INT8 DEFAULT '0' NOT NULL, + user_birthday varchar(10) DEFAULT '' NOT NULL, + user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0), + user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0), + user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0), + user_lastpage varchar(200) DEFAULT '' NOT NULL, + user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, + user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0), + user_warnings INT2 DEFAULT '0' NOT NULL, + user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0), + user_login_attempts INT2 DEFAULT '0' NOT NULL, + user_inactive_reason INT2 DEFAULT '0' NOT NULL, + user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0), + user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0), + user_lang varchar(30) DEFAULT '' NOT NULL, + user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, + user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0), + user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0), + user_colour varchar(6) DEFAULT '' NOT NULL, + user_new_privmsg INT4 DEFAULT '0' NOT NULL, + user_unread_privmsg INT4 DEFAULT '0' NOT NULL, + user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0), + user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0), + user_full_folder INT4 DEFAULT '-3' NOT NULL, + user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0), + user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0), + user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0), + user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, + user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), + user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0), + user_notify_type INT2 DEFAULT '0' NOT NULL, + user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0), + user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), + user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), + user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), + user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0), + user_avatar varchar(255) DEFAULT '' NOT NULL, + user_avatar_type varchar(255) DEFAULT '' NOT NULL, + user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), + user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0), + user_sig TEXT DEFAULT '' NOT NULL, + user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + user_from varchar(100) DEFAULT '' NOT NULL, + user_icq varchar(15) DEFAULT '' NOT NULL, + user_aim varchar(255) DEFAULT '' NOT NULL, + user_yim varchar(255) DEFAULT '' NOT NULL, + user_msnm varchar(255) DEFAULT '' NOT NULL, + user_jabber varchar(255) DEFAULT '' NOT NULL, + user_website varchar(200) DEFAULT '' NOT NULL, + user_occ varchar(4000) DEFAULT '' NOT NULL, + user_interests varchar(4000) DEFAULT '' NOT NULL, + user_actkey varchar(32) DEFAULT '' NOT NULL, + user_newpasswd varchar(40) DEFAULT '' NOT NULL, + user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), + user_reminded INT2 DEFAULT '0' NOT NULL, + user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0), + PRIMARY KEY (user_id) +); + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); + +/* + Table: 'phpbb_warnings' +*/ +CREATE SEQUENCE phpbb_warnings_seq; + +CREATE TABLE phpbb_warnings ( + warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0), + warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0), + PRIMARY KEY (warning_id) +); + + +/* + Table: 'phpbb_words' +*/ +CREATE SEQUENCE phpbb_words_seq; + +CREATE TABLE phpbb_words ( + word_id INT4 DEFAULT nextval('phpbb_words_seq'), + word varchar(255) DEFAULT '' NOT NULL, + replacement varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (word_id) +); + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE phpbb_zebra ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0), + friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0), + foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0), + PRIMARY KEY (user_id, zebra_id) +); + + +/* + Table: 'phpbb_gallery_albums' +*/ +CREATE SEQUENCE phpbb_gallery_albums_seq; + +CREATE TABLE phpbb_gallery_albums ( + album_id INT4 DEFAULT nextval('phpbb_gallery_albums_seq'), + parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), + left_id INT4 DEFAULT '1' NOT NULL CHECK (left_id >= 0), + right_id INT4 DEFAULT '2' NOT NULL CHECK (right_id >= 0), + album_parents TEXT DEFAULT '' NOT NULL, + album_type INT4 DEFAULT '1' NOT NULL CHECK (album_type >= 0), + album_status INT4 DEFAULT '1' NOT NULL CHECK (album_status >= 0), + album_contest INT4 DEFAULT '0' NOT NULL CHECK (album_contest >= 0), + album_name varchar(255) DEFAULT '' NOT NULL, + album_desc TEXT DEFAULT '' NOT NULL, + album_desc_options INT4 DEFAULT '7' NOT NULL CHECK (album_desc_options >= 0), + album_desc_uid varchar(8) DEFAULT '' NOT NULL, + album_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + album_user_id INT4 DEFAULT '0' NOT NULL CHECK (album_user_id >= 0), + album_images INT4 DEFAULT '0' NOT NULL CHECK (album_images >= 0), + album_images_real INT4 DEFAULT '0' NOT NULL CHECK (album_images_real >= 0), + album_last_image_id INT4 DEFAULT '0' NOT NULL CHECK (album_last_image_id >= 0), + album_image varchar(255) DEFAULT '' NOT NULL, + album_last_image_time INT4 DEFAULT '0' NOT NULL, + album_last_image_name varchar(255) DEFAULT '' NOT NULL, + album_last_username varchar(255) DEFAULT '' NOT NULL, + album_last_user_colour varchar(6) DEFAULT '' NOT NULL, + album_last_user_id INT4 DEFAULT '0' NOT NULL CHECK (album_last_user_id >= 0), + album_watermark INT4 DEFAULT '1' NOT NULL CHECK (album_watermark >= 0), + album_sort_key varchar(8) DEFAULT '' NOT NULL, + album_sort_dir varchar(8) DEFAULT '' NOT NULL, + display_in_rrc INT4 DEFAULT '1' NOT NULL CHECK (display_in_rrc >= 0), + display_on_index INT4 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), + display_subalbum_list INT4 DEFAULT '1' NOT NULL CHECK (display_subalbum_list >= 0), + album_feed INT2 DEFAULT '1' NOT NULL CHECK (album_feed >= 0), + album_auth_access INT2 DEFAULT '0' NOT NULL, + PRIMARY KEY (album_id) +); + + +/* + Table: 'phpbb_gallery_albums_track' +*/ +CREATE TABLE phpbb_gallery_albums_track ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + album_id INT4 DEFAULT '0' NOT NULL CHECK (album_id >= 0), + mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), + PRIMARY KEY (user_id, album_id) +); + + +/* + Table: 'phpbb_gallery_comments' +*/ +CREATE SEQUENCE phpbb_gallery_comments_seq; + +CREATE TABLE phpbb_gallery_comments ( + comment_id INT4 DEFAULT nextval('phpbb_gallery_comments_seq'), + comment_image_id INT4 NOT NULL CHECK (comment_image_id >= 0), + comment_user_id INT4 DEFAULT '0' NOT NULL CHECK (comment_user_id >= 0), + comment_username varchar(255) DEFAULT '' NOT NULL, + comment_user_colour varchar(6) DEFAULT '' NOT NULL, + comment_user_ip varchar(40) DEFAULT '' NOT NULL, + comment_signature INT2 DEFAULT '0' NOT NULL CHECK (comment_signature >= 0), + comment_time INT4 DEFAULT '0' NOT NULL CHECK (comment_time >= 0), + comment TEXT DEFAULT '' NOT NULL, + comment_uid varchar(8) DEFAULT '' NOT NULL, + comment_bitfield varchar(255) DEFAULT '' NOT NULL, + comment_edit_time INT4 DEFAULT '0' NOT NULL CHECK (comment_edit_time >= 0), + comment_edit_count INT2 DEFAULT '0' NOT NULL CHECK (comment_edit_count >= 0), + comment_edit_user_id INT4 DEFAULT '0' NOT NULL CHECK (comment_edit_user_id >= 0), + PRIMARY KEY (comment_id) +); + +CREATE INDEX phpbb_gallery_comments_id ON phpbb_gallery_comments (comment_image_id); +CREATE INDEX phpbb_gallery_comments_uid ON phpbb_gallery_comments (comment_user_id); +CREATE INDEX phpbb_gallery_comments_ip ON phpbb_gallery_comments (comment_user_ip); +CREATE INDEX phpbb_gallery_comments_time ON phpbb_gallery_comments (comment_time); + +/* + Table: 'phpbb_gallery_contests' +*/ +CREATE SEQUENCE phpbb_gallery_contests_seq; + +CREATE TABLE phpbb_gallery_contests ( + contest_id INT4 DEFAULT nextval('phpbb_gallery_contests_seq'), + contest_album_id INT4 DEFAULT '0' NOT NULL CHECK (contest_album_id >= 0), + contest_start INT4 DEFAULT '0' NOT NULL CHECK (contest_start >= 0), + contest_rating INT4 DEFAULT '0' NOT NULL CHECK (contest_rating >= 0), + contest_end INT4 DEFAULT '0' NOT NULL CHECK (contest_end >= 0), + contest_marked INT2 DEFAULT '0' NOT NULL, + contest_first INT4 DEFAULT '0' NOT NULL CHECK (contest_first >= 0), + contest_second INT4 DEFAULT '0' NOT NULL CHECK (contest_second >= 0), + contest_third INT4 DEFAULT '0' NOT NULL CHECK (contest_third >= 0), + PRIMARY KEY (contest_id) +); + + +/* + Table: 'phpbb_gallery_favorites' +*/ +CREATE SEQUENCE phpbb_gallery_favorites_seq; + +CREATE TABLE phpbb_gallery_favorites ( + favorite_id INT4 DEFAULT nextval('phpbb_gallery_favorites_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + image_id INT4 DEFAULT '0' NOT NULL CHECK (image_id >= 0), + PRIMARY KEY (favorite_id) +); + +CREATE INDEX phpbb_gallery_favorites_uid ON phpbb_gallery_favorites (user_id); +CREATE INDEX phpbb_gallery_favorites_id ON phpbb_gallery_favorites (image_id); + +/* + Table: 'phpbb_gallery_images' +*/ +CREATE SEQUENCE phpbb_gallery_images_seq; + +CREATE TABLE phpbb_gallery_images ( + image_id INT4 DEFAULT nextval('phpbb_gallery_images_seq'), + image_filename varchar(255) DEFAULT '' NOT NULL, + image_name varchar(255) DEFAULT '' NOT NULL, + image_name_clean varchar(255) DEFAULT '' NOT NULL, + image_desc TEXT DEFAULT '' NOT NULL, + image_desc_uid varchar(8) DEFAULT '' NOT NULL, + image_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + image_user_id INT4 DEFAULT '0' NOT NULL CHECK (image_user_id >= 0), + image_username varchar(255) DEFAULT '' NOT NULL, + image_username_clean varchar(255) DEFAULT '' NOT NULL, + image_user_colour varchar(6) DEFAULT '' NOT NULL, + image_user_ip varchar(40) DEFAULT '' NOT NULL, + image_time INT4 DEFAULT '0' NOT NULL CHECK (image_time >= 0), + image_album_id INT4 DEFAULT '0' NOT NULL CHECK (image_album_id >= 0), + image_view_count INT4 DEFAULT '0' NOT NULL CHECK (image_view_count >= 0), + image_status INT4 DEFAULT '0' NOT NULL CHECK (image_status >= 0), + image_contest INT4 DEFAULT '0' NOT NULL CHECK (image_contest >= 0), + image_contest_end INT4 DEFAULT '0' NOT NULL CHECK (image_contest_end >= 0), + image_contest_rank INT4 DEFAULT '0' NOT NULL CHECK (image_contest_rank >= 0), + image_filemissing INT4 DEFAULT '0' NOT NULL CHECK (image_filemissing >= 0), + image_has_exif INT4 DEFAULT '2' NOT NULL CHECK (image_has_exif >= 0), + image_exif_data varchar(8000) DEFAULT '' NOT NULL, + image_rates INT4 DEFAULT '0' NOT NULL CHECK (image_rates >= 0), + image_rate_points INT4 DEFAULT '0' NOT NULL CHECK (image_rate_points >= 0), + image_rate_avg INT4 DEFAULT '0' NOT NULL CHECK (image_rate_avg >= 0), + image_comments INT4 DEFAULT '0' NOT NULL CHECK (image_comments >= 0), + image_last_comment INT4 DEFAULT '0' NOT NULL CHECK (image_last_comment >= 0), + image_allow_comments INT2 DEFAULT '1' NOT NULL, + image_favorited INT4 DEFAULT '0' NOT NULL CHECK (image_favorited >= 0), + image_reported INT4 DEFAULT '0' NOT NULL CHECK (image_reported >= 0), + filesize_upload INT4 DEFAULT '0' NOT NULL CHECK (filesize_upload >= 0), + filesize_medium INT4 DEFAULT '0' NOT NULL CHECK (filesize_medium >= 0), + filesize_cache INT4 DEFAULT '0' NOT NULL CHECK (filesize_cache >= 0), + PRIMARY KEY (image_id) +); + +CREATE INDEX phpbb_gallery_images_aid ON phpbb_gallery_images (image_album_id); +CREATE INDEX phpbb_gallery_images_uid ON phpbb_gallery_images (image_user_id); +CREATE INDEX phpbb_gallery_images_time ON phpbb_gallery_images (image_time); + +/* + Table: 'phpbb_gallery_modscache' +*/ +CREATE TABLE phpbb_gallery_modscache ( + album_id INT4 DEFAULT '0' NOT NULL CHECK (album_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + username varchar(255) DEFAULT '' NOT NULL, + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index INT2 DEFAULT '1' NOT NULL +); + +CREATE INDEX phpbb_gallery_modscache_doi ON phpbb_gallery_modscache (display_on_index); +CREATE INDEX phpbb_gallery_modscache_aid ON phpbb_gallery_modscache (album_id); + +/* + Table: 'phpbb_gallery_permissions' +*/ +CREATE SEQUENCE phpbb_gallery_permissions_seq; + +CREATE TABLE phpbb_gallery_permissions ( + perm_id INT4 DEFAULT nextval('phpbb_gallery_permissions_seq'), + perm_role_id INT4 DEFAULT '0' NOT NULL CHECK (perm_role_id >= 0), + perm_album_id INT4 DEFAULT '0' NOT NULL CHECK (perm_album_id >= 0), + perm_user_id INT4 DEFAULT '0' NOT NULL CHECK (perm_user_id >= 0), + perm_group_id INT4 DEFAULT '0' NOT NULL CHECK (perm_group_id >= 0), + perm_system INT4 DEFAULT '0' NOT NULL, + PRIMARY KEY (perm_id) +); + + +/* + Table: 'phpbb_gallery_rates' +*/ +CREATE TABLE phpbb_gallery_rates ( + rate_image_id INT4 DEFAULT '0' NOT NULL CHECK (rate_image_id >= 0), + rate_user_id INT4 DEFAULT '0' NOT NULL CHECK (rate_user_id >= 0), + rate_user_ip varchar(40) DEFAULT '' NOT NULL, + rate_point INT4 DEFAULT '0' NOT NULL CHECK (rate_point >= 0), + PRIMARY KEY (rate_image_id, rate_user_id) +); + + +/* + Table: 'phpbb_gallery_reports' +*/ +CREATE SEQUENCE phpbb_gallery_reports_seq; + +CREATE TABLE phpbb_gallery_reports ( + report_id INT4 DEFAULT nextval('phpbb_gallery_reports_seq'), + report_album_id INT4 DEFAULT '0' NOT NULL CHECK (report_album_id >= 0), + report_image_id INT4 DEFAULT '0' NOT NULL CHECK (report_image_id >= 0), + reporter_id INT4 DEFAULT '0' NOT NULL CHECK (reporter_id >= 0), + report_manager INT4 DEFAULT '0' NOT NULL CHECK (report_manager >= 0), + report_note TEXT DEFAULT '' NOT NULL, + report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), + report_status INT4 DEFAULT '0' NOT NULL CHECK (report_status >= 0), + PRIMARY KEY (report_id) +); + + +/* + Table: 'phpbb_gallery_roles' +*/ +CREATE SEQUENCE phpbb_gallery_roles_seq; + +CREATE TABLE phpbb_gallery_roles ( + role_id INT4 DEFAULT nextval('phpbb_gallery_roles_seq'), + a_list INT4 DEFAULT '0' NOT NULL CHECK (a_list >= 0), + i_view INT4 DEFAULT '0' NOT NULL CHECK (i_view >= 0), + i_watermark INT4 DEFAULT '0' NOT NULL CHECK (i_watermark >= 0), + i_upload INT4 DEFAULT '0' NOT NULL CHECK (i_upload >= 0), + i_edit INT4 DEFAULT '0' NOT NULL CHECK (i_edit >= 0), + i_delete INT4 DEFAULT '0' NOT NULL CHECK (i_delete >= 0), + i_rate INT4 DEFAULT '0' NOT NULL CHECK (i_rate >= 0), + i_approve INT4 DEFAULT '0' NOT NULL CHECK (i_approve >= 0), + i_lock INT4 DEFAULT '0' NOT NULL CHECK (i_lock >= 0), + i_report INT4 DEFAULT '0' NOT NULL CHECK (i_report >= 0), + i_count INT4 DEFAULT '0' NOT NULL CHECK (i_count >= 0), + i_unlimited INT4 DEFAULT '0' NOT NULL CHECK (i_unlimited >= 0), + c_read INT4 DEFAULT '0' NOT NULL CHECK (c_read >= 0), + c_post INT4 DEFAULT '0' NOT NULL CHECK (c_post >= 0), + c_edit INT4 DEFAULT '0' NOT NULL CHECK (c_edit >= 0), + c_delete INT4 DEFAULT '0' NOT NULL CHECK (c_delete >= 0), + m_comments INT4 DEFAULT '0' NOT NULL CHECK (m_comments >= 0), + m_delete INT4 DEFAULT '0' NOT NULL CHECK (m_delete >= 0), + m_edit INT4 DEFAULT '0' NOT NULL CHECK (m_edit >= 0), + m_move INT4 DEFAULT '0' NOT NULL CHECK (m_move >= 0), + m_report INT4 DEFAULT '0' NOT NULL CHECK (m_report >= 0), + m_status INT4 DEFAULT '0' NOT NULL CHECK (m_status >= 0), + a_count INT4 DEFAULT '0' NOT NULL CHECK (a_count >= 0), + a_unlimited INT4 DEFAULT '0' NOT NULL CHECK (a_unlimited >= 0), + a_restrict INT4 DEFAULT '0' NOT NULL CHECK (a_restrict >= 0), + PRIMARY KEY (role_id) +); + + +/* + Table: 'phpbb_gallery_users' +*/ +CREATE TABLE phpbb_gallery_users ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + watch_own INT4 DEFAULT '0' NOT NULL CHECK (watch_own >= 0), + watch_favo INT4 DEFAULT '0' NOT NULL CHECK (watch_favo >= 0), + watch_com INT4 DEFAULT '0' NOT NULL CHECK (watch_com >= 0), + user_images INT4 DEFAULT '0' NOT NULL CHECK (user_images >= 0), + personal_album_id INT4 DEFAULT '0' NOT NULL CHECK (personal_album_id >= 0), + user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0), + user_last_update INT4 DEFAULT '0' NOT NULL CHECK (user_last_update >= 0), + user_viewexif INT4 DEFAULT '0' NOT NULL CHECK (user_viewexif >= 0), + user_permissions TEXT DEFAULT '' NOT NULL, + user_permissions_changed INT4 DEFAULT '0' NOT NULL CHECK (user_permissions_changed >= 0), + user_allow_comments INT2 DEFAULT '1' NOT NULL, + subscribe_pegas INT2 DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +); + +CREATE INDEX phpbb_gallery_users_pega ON phpbb_gallery_users (personal_album_id); + +/* + Table: 'phpbb_gallery_watch' +*/ +CREATE SEQUENCE phpbb_gallery_watch_seq; + +CREATE TABLE phpbb_gallery_watch ( + watch_id INT4 DEFAULT nextval('phpbb_gallery_watch_seq'), + album_id INT4 DEFAULT '0' NOT NULL CHECK (album_id >= 0), + image_id INT4 DEFAULT '0' NOT NULL CHECK (image_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + PRIMARY KEY (watch_id) +); + +CREATE INDEX phpbb_gallery_watch_uid ON phpbb_gallery_watch (user_id); +CREATE INDEX phpbb_gallery_watch_id ON phpbb_gallery_watch (image_id); +CREATE INDEX phpbb_gallery_watch_aid ON phpbb_gallery_watch (album_id); + + +COMMIT; \ No newline at end of file diff --git a/tests/schemas/sqlite_schema.sql b/tests/schemas/sqlite_schema.sql new file mode 100644 index 00000000..44b5919a --- /dev/null +++ b/tests/schemas/sqlite_schema.sql @@ -0,0 +1,1297 @@ +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +BEGIN TRANSACTION; + +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id INTEGER PRIMARY KEY NOT NULL , + post_msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + in_message INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + is_orphan INTEGER UNSIGNED NOT NULL DEFAULT '1', + physical_filename varchar(255) NOT NULL DEFAULT '', + real_filename varchar(255) NOT NULL DEFAULT '', + download_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + attach_comment text(65535) NOT NULL DEFAULT '', + extension varchar(100) NOT NULL DEFAULT '', + mimetype varchar(100) NOT NULL DEFAULT '', + filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', + filetime INTEGER UNSIGNED NOT NULL DEFAULT '0', + thumbnail INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id INTEGER PRIMARY KEY NOT NULL , + auth_option varchar(50) NOT NULL DEFAULT '', + is_global INTEGER UNSIGNED NOT NULL DEFAULT '0', + is_local INTEGER UNSIGNED NOT NULL DEFAULT '0', + founder_only INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id INTEGER PRIMARY KEY NOT NULL , + role_name varchar(255) NOT NULL DEFAULT '', + role_description text(65535) NOT NULL DEFAULT '', + role_type varchar(10) NOT NULL DEFAULT '', + role_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0', + PRIMARY KEY (role_id, auth_option_id) +); + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id INTEGER PRIMARY KEY NOT NULL , + ban_userid INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_ip varchar(40) NOT NULL DEFAULT '', + ban_email varchar(100) NOT NULL DEFAULT '', + ban_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_end INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_reason varchar(255) NOT NULL DEFAULT '', + ban_give_reason varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_tag varchar(16) NOT NULL DEFAULT '', + bbcode_helpline varchar(255) NOT NULL DEFAULT '', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_match text(65535) NOT NULL DEFAULT '', + bbcode_tpl mediumtext(16777215) NOT NULL DEFAULT '', + first_pass_match mediumtext(16777215) NOT NULL DEFAULT '', + first_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', + second_pass_match mediumtext(16777215) NOT NULL DEFAULT '', + second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (bbcode_id) +); + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (topic_id, user_id) +); + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id INTEGER PRIMARY KEY NOT NULL , + bot_active INTEGER UNSIGNED NOT NULL DEFAULT '1', + bot_name text(65535) NOT NULL DEFAULT '', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + bot_agent varchar(255) NOT NULL DEFAULT '', + bot_ip varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varchar(255) NOT NULL DEFAULT '', + config_value varchar(255) NOT NULL DEFAULT '', + is_dynamic INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (config_name) +); + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); + +# Table: 'phpbb_config_text' +CREATE TABLE phpbb_config_text ( + config_name varchar(255) NOT NULL DEFAULT '', + config_value mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (config_name) +); + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id char(32) NOT NULL DEFAULT '', + session_id char(32) NOT NULL DEFAULT '', + confirm_type tinyint(3) NOT NULL DEFAULT '0', + code varchar(8) NOT NULL DEFAULT '', + seed INTEGER UNSIGNED NOT NULL DEFAULT '0', + attempts INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (session_id, confirm_id) +); + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id INTEGER PRIMARY KEY NOT NULL , + disallow_username varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + save_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + draft_subject text(65535) NOT NULL DEFAULT '', + draft_message mediumtext(16777215) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) NOT NULL DEFAULT '', + ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0', + ext_state text(65535) NOT NULL DEFAULT '' +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + extension varchar(100) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id INTEGER PRIMARY KEY NOT NULL , + group_name varchar(255) NOT NULL DEFAULT '', + cat_id tinyint(2) NOT NULL DEFAULT '0', + allow_group INTEGER UNSIGNED NOT NULL DEFAULT '0', + download_mode INTEGER UNSIGNED NOT NULL DEFAULT '1', + upload_icon varchar(255) NOT NULL DEFAULT '', + max_filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', + allowed_forums text(65535) NOT NULL DEFAULT '', + allow_in_pm INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id INTEGER PRIMARY KEY NOT NULL , + parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_parents mediumtext(16777215) NOT NULL DEFAULT '', + forum_name text(65535) NOT NULL DEFAULT '', + forum_desc text(65535) NOT NULL DEFAULT '', + forum_desc_bitfield varchar(255) NOT NULL DEFAULT '', + forum_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + forum_desc_uid varchar(8) NOT NULL DEFAULT '', + forum_link varchar(255) NOT NULL DEFAULT '', + forum_password varchar(40) NOT NULL DEFAULT '', + forum_style INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_image varchar(255) NOT NULL DEFAULT '', + forum_rules text(65535) NOT NULL DEFAULT '', + forum_rules_link varchar(255) NOT NULL DEFAULT '', + forum_rules_bitfield varchar(255) NOT NULL DEFAULT '', + forum_rules_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + forum_rules_uid varchar(8) 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_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_post_subject text(65535) NOT NULL DEFAULT '', + forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_poster_name varchar(255) NOT NULL DEFAULT '', + forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', + forum_flags tinyint(4) NOT NULL DEFAULT '32', + forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', + display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_icons INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_prune INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_next INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_viewed INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_freq INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + PRIMARY KEY (forum_id, user_id, session_id) +); + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, forum_id) +); + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id INTEGER PRIMARY KEY NOT NULL , + group_type tinyint(4) NOT NULL DEFAULT '1', + group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_name varchar(255) NOT NULL DEFAULT '', + group_desc text(65535) NOT NULL DEFAULT '', + group_desc_bitfield varchar(255) NOT NULL DEFAULT '', + group_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + group_desc_uid varchar(8) NOT NULL DEFAULT '', + group_display INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_avatar varchar(255) NOT NULL DEFAULT '', + group_avatar_type varchar(255) NOT NULL DEFAULT '', + group_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_colour varchar(6) NOT NULL DEFAULT '', + group_sig_chars INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id INTEGER PRIMARY KEY NOT NULL , + icons_url varchar(255) NOT NULL DEFAULT '', + icons_width tinyint(4) NOT NULL DEFAULT '0', + icons_height tinyint(4) NOT NULL DEFAULT '0', + icons_order INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id INTEGER PRIMARY KEY NOT NULL , + lang_iso varchar(30) NOT NULL DEFAULT '', + lang_dir varchar(30) NOT NULL DEFAULT '', + lang_english_name varchar(100) NOT NULL DEFAULT '', + lang_local_name varchar(255) NOT NULL DEFAULT '', + lang_author varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id INTEGER PRIMARY KEY NOT NULL , + log_type tinyint(4) NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + reportee_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_ip varchar(40) NOT NULL DEFAULT '', + log_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_operation text(65535) NOT NULL DEFAULT '', + log_data mediumtext(16777215) NOT NULL DEFAULT '', + album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_id INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) NOT NULL DEFAULT '', + attempt_browser varchar(150) NOT NULL DEFAULT '', + attempt_forwarded_for varchar(255) NOT NULL DEFAULT '', + attempt_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '0', + username_clean varchar(255) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '', + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_name varchar(255) NOT NULL DEFAULT '', + display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); + +# Table: 'phpbb_migrations' +CREATE TABLE phpbb_migrations ( + migration_name varchar(255) NOT NULL DEFAULT '', + migration_depends_on text(65535) NOT NULL DEFAULT '', + migration_schema_done INTEGER UNSIGNED NOT NULL DEFAULT '0', + migration_data_done INTEGER UNSIGNED NOT NULL DEFAULT '0', + migration_data_state text(65535) NOT NULL DEFAULT '', + migration_start_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + migration_end_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (migration_name) +); + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id INTEGER PRIMARY KEY NOT NULL , + module_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1', + module_display INTEGER UNSIGNED NOT NULL DEFAULT '1', + module_basename varchar(255) NOT NULL DEFAULT '', + module_class varchar(10) NOT NULL DEFAULT '', + parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + module_langname varchar(255) NOT NULL DEFAULT '', + module_mode varchar(255) NOT NULL DEFAULT '', + module_auth varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); + +# Table: 'phpbb_notification_types' +CREATE TABLE phpbb_notification_types ( + notification_type_id INTEGER PRIMARY KEY NOT NULL , + notification_type_name varchar(255) NOT NULL DEFAULT '', + notification_type_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name); + +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id INTEGER PRIMARY KEY NOT NULL , + notification_type_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + item_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + notification_read INTEGER UNSIGNED NOT NULL DEFAULT '0', + notification_time INTEGER UNSIGNED NOT NULL DEFAULT '1', + notification_data text(65535) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id); +CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read); + +# Table: 'phpbb_oauth_accounts' +CREATE TABLE phpbb_oauth_accounts ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + provider varchar(255) NOT NULL DEFAULT '', + oauth_provider_id text(65535) NOT NULL DEFAULT '', + PRIMARY KEY (user_id, provider) +); + + +# Table: 'phpbb_oauth_tokens' +CREATE TABLE phpbb_oauth_tokens ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + provider varchar(255) NOT NULL DEFAULT '', + oauth_token mediumtext(16777215) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id); +CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider); + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_option_text text(65535) NOT NULL DEFAULT '', + poll_option_total INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + vote_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + vote_user_ip varchar(40) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id INTEGER PRIMARY KEY NOT NULL , + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_ip varchar(40) NOT NULL DEFAULT '', + post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_visibility tinyint(3) NOT NULL DEFAULT '0', + post_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', + enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', + post_username varchar(255) NOT NULL DEFAULT '', + post_subject text(65535) NOT NULL DEFAULT '', + post_text mediumtext(16777215) NOT NULL DEFAULT '', + post_checksum varchar(32) NOT NULL DEFAULT '', + post_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + post_postcount INTEGER UNSIGNED NOT NULL DEFAULT '1', + post_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_reason text(65535) NOT NULL DEFAULT '', + post_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_delete_reason text(65535) NOT NULL DEFAULT '', + post_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); +CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id INTEGER PRIMARY KEY NOT NULL , + root_level INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_ip varchar(40) NOT NULL DEFAULT '', + message_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', + message_subject text(65535) NOT NULL DEFAULT '', + message_text mediumtext(16777215) NOT NULL DEFAULT '', + message_edit_reason text(65535) NOT NULL DEFAULT '', + message_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', + message_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + to_address text(65535) NOT NULL DEFAULT '', + bcc_address text(65535) NOT NULL DEFAULT '', + message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + folder_name varchar(255) NOT NULL DEFAULT '', + pm_count INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_check INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_connection INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_string varchar(255) NOT NULL DEFAULT '', + rule_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_action INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_folder_id int(11) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_deleted INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_new INTEGER UNSIGNED NOT NULL DEFAULT '1', + pm_unread INTEGER UNSIGNED NOT NULL DEFAULT '1', + pm_replied INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_marked INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_forwarded INTEGER UNSIGNED NOT NULL DEFAULT '0', + folder_id int(11) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id INTEGER PRIMARY KEY NOT NULL , + field_name varchar(255) NOT NULL DEFAULT '', + field_type tinyint(4) NOT NULL DEFAULT '0', + field_ident varchar(20) NOT NULL DEFAULT '', + field_length varchar(20) NOT NULL DEFAULT '', + field_minlen varchar(255) NOT NULL DEFAULT '', + field_maxlen varchar(255) NOT NULL DEFAULT '', + field_novalue varchar(255) NOT NULL DEFAULT '', + field_default_value varchar(255) NOT NULL DEFAULT '', + field_validation varchar(20) NOT NULL DEFAULT '', + field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_novalue INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_active INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id) +); + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_type tinyint(4) NOT NULL DEFAULT '0', + lang_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id, option_id) +); + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_name varchar(255) NOT NULL DEFAULT '', + lang_explain text(65535) NOT NULL DEFAULT '', + lang_default_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id) +); + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id INTEGER PRIMARY KEY NOT NULL , + rank_title varchar(255) NOT NULL DEFAULT '', + rank_min INTEGER UNSIGNED NOT NULL DEFAULT '0', + rank_special INTEGER UNSIGNED NOT NULL DEFAULT '0', + rank_image varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id INTEGER PRIMARY KEY NOT NULL , + reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_text mediumtext(16777215) NOT NULL DEFAULT '', + reported_post_text mediumtext(16777215) NOT NULL DEFAULT '', + reported_post_uid varchar(8) NOT NULL DEFAULT '', + reported_post_bitfield varchar(255) NOT NULL DEFAULT '', + reported_post_enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', + reported_post_enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', + reported_post_enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id INTEGER PRIMARY KEY NOT NULL , + reason_title varchar(255) NOT NULL DEFAULT '', + reason_description mediumtext(16777215) NOT NULL DEFAULT '', + reason_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varchar(32) NOT NULL DEFAULT '', + search_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + search_keywords mediumtext(16777215) NOT NULL DEFAULT '', + search_authors mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (search_key) +); + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id INTEGER PRIMARY KEY NOT NULL , + word_text varchar(255) NOT NULL DEFAULT '', + word_common INTEGER UNSIGNED NOT NULL DEFAULT '0', + word_count INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + word_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + title_match INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id char(32) NOT NULL DEFAULT '', + session_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_last_visit INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_ip varchar(40) NOT NULL DEFAULT '', + session_browser varchar(150) NOT NULL DEFAULT '', + session_forwarded_for varchar(255) NOT NULL DEFAULT '', + session_page varchar(255) NOT NULL DEFAULT '', + session_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', + session_autologin INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_admin INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (session_id) +); + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); +CREATE INDEX phpbb_sessions_session_aid ON phpbb_sessions (session_album_id); + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) NOT NULL DEFAULT '', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + last_ip varchar(40) NOT NULL DEFAULT '', + last_login INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (key_id, user_id) +); + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); + +# 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 INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id INTEGER PRIMARY KEY NOT NULL , + code varchar(50) NOT NULL DEFAULT '', + emotion varchar(50) NOT NULL DEFAULT '', + smiley_url varchar(50) NOT NULL DEFAULT '', + smiley_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + smiley_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + smiley_order INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id INTEGER PRIMARY KEY NOT NULL , + style_name varchar(255) NOT NULL DEFAULT '', + style_copyright varchar(255) NOT NULL DEFAULT '', + style_active INTEGER UNSIGNED NOT NULL DEFAULT '1', + style_path varchar(100) NOT NULL DEFAULT '', + bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=', + style_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + style_parent_tree text(65535) NOT NULL DEFAULT '' +); + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); + +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + teampage_name varchar(255) NOT NULL DEFAULT '', + teampage_position INTEGER UNSIGNED NOT NULL DEFAULT '0', + teampage_parent INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id INTEGER PRIMARY KEY NOT NULL , + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_visibility tinyint(3) NOT NULL DEFAULT '0', + topic_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_title text(65535) NOT NULL DEFAULT '', + topic_poster INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_status tinyint(3) NOT NULL DEFAULT '0', + topic_type tinyint(3) NOT NULL DEFAULT '0', + topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_first_poster_name varchar(255) NOT NULL DEFAULT '', + topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_poster_name varchar(255) NOT NULL DEFAULT '', + topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_subject text(65535) NOT NULL DEFAULT '', + topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_bumped INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_bumper INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_title text(65535) NOT NULL DEFAULT '', + poll_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_length INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_max_options tinyint(4) NOT NULL DEFAULT '1', + poll_last_vote INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_delete_reason text(65535) NOT NULL DEFAULT '', + topic_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); +CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility); +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id); +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +); + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posted INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +); + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); + +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) NOT NULL DEFAULT '', + item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + method varchar(255) NOT NULL DEFAULT '', + notify INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_leader INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_pending INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id INTEGER PRIMARY KEY NOT NULL , + user_type tinyint(2) NOT NULL DEFAULT '0', + group_id INTEGER UNSIGNED NOT NULL DEFAULT '3', + user_permissions mediumtext(16777215) NOT NULL DEFAULT '', + user_perm_from INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_ip varchar(40) NOT NULL DEFAULT '', + user_regdate INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '', + username_clean varchar(255) NOT NULL DEFAULT '', + user_password varchar(40) NOT NULL DEFAULT '', + user_passchg INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_pass_convert INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_email varchar(100) NOT NULL DEFAULT '', + user_email_hash bigint(20) NOT NULL DEFAULT '0', + user_birthday varchar(10) NOT NULL DEFAULT '', + user_lastvisit INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastmark INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastpost_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastpage varchar(200) NOT NULL DEFAULT '', + user_last_confirm_key varchar(10) NOT NULL DEFAULT '', + user_last_search INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_warnings tinyint(4) NOT NULL DEFAULT '0', + user_last_warning INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_login_attempts tinyint(4) NOT NULL DEFAULT '0', + user_inactive_reason tinyint(2) NOT NULL DEFAULT '0', + user_inactive_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lang varchar(30) NOT NULL DEFAULT '', + user_timezone varchar(100) NOT NULL DEFAULT 'UTC', + user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', + user_style INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_colour varchar(6) NOT NULL DEFAULT '', + user_new_privmsg int(4) NOT NULL DEFAULT '0', + user_unread_privmsg int(4) NOT NULL DEFAULT '0', + user_last_privmsg INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_message_rules INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_full_folder int(11) NOT NULL DEFAULT '-3', + user_emailtime INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_topic_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', + user_post_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', + user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_notify_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_notify_type tinyint(4) NOT NULL DEFAULT '0', + user_allow_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271', + user_avatar varchar(255) NOT NULL DEFAULT '', + user_avatar_type varchar(255) NOT NULL DEFAULT '', + user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_sig mediumtext(16777215) NOT NULL DEFAULT '', + user_sig_bbcode_uid varchar(8) NOT NULL DEFAULT '', + user_sig_bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + user_from varchar(100) NOT NULL DEFAULT '', + user_icq varchar(15) NOT NULL DEFAULT '', + user_aim varchar(255) NOT NULL DEFAULT '', + user_yim varchar(255) NOT NULL DEFAULT '', + user_msnm varchar(255) NOT NULL DEFAULT '', + user_jabber varchar(255) NOT NULL DEFAULT '', + user_website varchar(200) NOT NULL DEFAULT '', + user_occ text(65535) NOT NULL DEFAULT '', + user_interests text(65535) NOT NULL DEFAULT '', + user_actkey varchar(32) NOT NULL DEFAULT '', + user_newpasswd varchar(40) NOT NULL DEFAULT '', + user_form_salt varchar(32) NOT NULL DEFAULT '', + user_new INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_reminded tinyint(4) NOT NULL DEFAULT '0', + user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + warning_time INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id INTEGER PRIMARY KEY NOT NULL , + word varchar(255) NOT NULL DEFAULT '', + replacement varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + zebra_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + friend INTEGER UNSIGNED NOT NULL DEFAULT '0', + foe INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, zebra_id) +); + + +# Table: 'phpbb_gallery_albums' +CREATE TABLE phpbb_gallery_albums ( + album_id INTEGER PRIMARY KEY NOT NULL , + parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + left_id INTEGER UNSIGNED NOT NULL DEFAULT '1', + right_id INTEGER UNSIGNED NOT NULL DEFAULT '2', + album_parents mediumtext(16777215) NOT NULL DEFAULT '', + album_type INTEGER UNSIGNED NOT NULL DEFAULT '1', + album_status INTEGER UNSIGNED NOT NULL DEFAULT '1', + album_contest INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_name varchar(255) NOT NULL DEFAULT '', + album_desc mediumtext(16777215) NOT NULL DEFAULT '', + album_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + album_desc_uid varchar(8) NOT NULL DEFAULT '', + album_desc_bitfield varchar(255) NOT NULL DEFAULT '', + album_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_images INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_images_real INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_last_image_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_image varchar(255) NOT NULL DEFAULT '', + album_last_image_time int(11) NOT NULL DEFAULT '0', + album_last_image_name varchar(255) NOT NULL DEFAULT '', + album_last_username varchar(255) NOT NULL DEFAULT '', + album_last_user_colour varchar(6) NOT NULL DEFAULT '', + album_last_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_watermark INTEGER UNSIGNED NOT NULL DEFAULT '1', + album_sort_key varchar(8) NOT NULL DEFAULT '', + album_sort_dir varchar(8) NOT NULL DEFAULT '', + display_in_rrc INTEGER UNSIGNED NOT NULL DEFAULT '1', + display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', + display_subalbum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', + album_feed INTEGER UNSIGNED NOT NULL DEFAULT '1', + album_auth_access tinyint(1) NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_gallery_albums_track' +CREATE TABLE phpbb_gallery_albums_track ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, album_id) +); + + +# Table: 'phpbb_gallery_comments' +CREATE TABLE phpbb_gallery_comments ( + comment_id INTEGER PRIMARY KEY NOT NULL , + comment_image_id INTEGER UNSIGNED NOT NULL , + comment_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + comment_username varchar(255) NOT NULL DEFAULT '', + comment_user_colour varchar(6) NOT NULL DEFAULT '', + comment_user_ip varchar(40) NOT NULL DEFAULT '', + comment_signature INTEGER UNSIGNED NOT NULL DEFAULT '0', + comment_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + comment mediumtext(16777215) NOT NULL DEFAULT '', + comment_uid varchar(8) NOT NULL DEFAULT '', + comment_bitfield varchar(255) NOT NULL DEFAULT '', + comment_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + comment_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + comment_edit_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_gallery_comments_id ON phpbb_gallery_comments (comment_image_id); +CREATE INDEX phpbb_gallery_comments_uid ON phpbb_gallery_comments (comment_user_id); +CREATE INDEX phpbb_gallery_comments_ip ON phpbb_gallery_comments (comment_user_ip); +CREATE INDEX phpbb_gallery_comments_time ON phpbb_gallery_comments (comment_time); + +# Table: 'phpbb_gallery_contests' +CREATE TABLE phpbb_gallery_contests ( + contest_id INTEGER PRIMARY KEY NOT NULL , + contest_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_rating INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_end INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_marked tinyint(1) NOT NULL DEFAULT '0', + contest_first INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_second INTEGER UNSIGNED NOT NULL DEFAULT '0', + contest_third INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_gallery_favorites' +CREATE TABLE phpbb_gallery_favorites ( + favorite_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_id INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_gallery_favorites_uid ON phpbb_gallery_favorites (user_id); +CREATE INDEX phpbb_gallery_favorites_id ON phpbb_gallery_favorites (image_id); + +# Table: 'phpbb_gallery_images' +CREATE TABLE phpbb_gallery_images ( + image_id INTEGER PRIMARY KEY NOT NULL , + image_filename varchar(255) NOT NULL DEFAULT '', + image_name varchar(255) NOT NULL DEFAULT '', + image_name_clean varchar(255) NOT NULL DEFAULT '', + image_desc mediumtext(16777215) NOT NULL DEFAULT '', + image_desc_uid varchar(8) NOT NULL DEFAULT '', + image_desc_bitfield varchar(255) NOT NULL DEFAULT '', + image_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_username varchar(255) NOT NULL DEFAULT '', + image_username_clean varchar(255) NOT NULL DEFAULT '', + image_user_colour varchar(6) NOT NULL DEFAULT '', + image_user_ip varchar(40) NOT NULL DEFAULT '', + image_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_view_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_status INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_contest INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_contest_end INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_contest_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_filemissing INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_has_exif INTEGER UNSIGNED NOT NULL DEFAULT '2', + image_exif_data text(65535) NOT NULL DEFAULT '', + image_rates INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_rate_points INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_rate_avg INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_comments INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_last_comment INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_allow_comments tinyint(1) NOT NULL DEFAULT '1', + image_favorited INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', + filesize_upload INTEGER UNSIGNED NOT NULL DEFAULT '0', + filesize_medium INTEGER UNSIGNED NOT NULL DEFAULT '0', + filesize_cache INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_gallery_images_aid ON phpbb_gallery_images (image_album_id); +CREATE INDEX phpbb_gallery_images_uid ON phpbb_gallery_images (image_user_id); +CREATE INDEX phpbb_gallery_images_time ON phpbb_gallery_images (image_time); + +# Table: 'phpbb_gallery_modscache' +CREATE TABLE phpbb_gallery_modscache ( + album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '', + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_name varchar(255) NOT NULL DEFAULT '', + display_on_index tinyint(1) NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_gallery_modscache_doi ON phpbb_gallery_modscache (display_on_index); +CREATE INDEX phpbb_gallery_modscache_aid ON phpbb_gallery_modscache (album_id); + +# Table: 'phpbb_gallery_permissions' +CREATE TABLE phpbb_gallery_permissions ( + perm_id INTEGER PRIMARY KEY NOT NULL , + perm_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + perm_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + perm_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + perm_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + perm_system int(3) NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_gallery_rates' +CREATE TABLE phpbb_gallery_rates ( + rate_image_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rate_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rate_user_ip varchar(40) NOT NULL DEFAULT '', + rate_point INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (rate_image_id, rate_user_id) +); + + +# Table: 'phpbb_gallery_reports' +CREATE TABLE phpbb_gallery_reports ( + report_id INTEGER PRIMARY KEY NOT NULL , + report_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_image_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + reporter_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_manager INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_note mediumtext(16777215) NOT NULL DEFAULT '', + report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_status INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_gallery_roles' +CREATE TABLE phpbb_gallery_roles ( + role_id INTEGER PRIMARY KEY NOT NULL , + a_list INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_view INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_watermark INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_upload INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_edit INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_delete INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_rate INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_approve INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_lock INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_report INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + i_unlimited INTEGER UNSIGNED NOT NULL DEFAULT '0', + c_read INTEGER UNSIGNED NOT NULL DEFAULT '0', + c_post INTEGER UNSIGNED NOT NULL DEFAULT '0', + c_edit INTEGER UNSIGNED NOT NULL DEFAULT '0', + c_delete INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_comments INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_delete INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_edit INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_move INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_report INTEGER UNSIGNED NOT NULL DEFAULT '0', + m_status INTEGER UNSIGNED NOT NULL DEFAULT '0', + a_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + a_unlimited INTEGER UNSIGNED NOT NULL DEFAULT '0', + a_restrict INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_gallery_users' +CREATE TABLE phpbb_gallery_users ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + watch_own INTEGER UNSIGNED NOT NULL DEFAULT '0', + watch_favo INTEGER UNSIGNED NOT NULL DEFAULT '0', + watch_com INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_images INTEGER UNSIGNED NOT NULL DEFAULT '0', + personal_album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastmark INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_last_update INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_viewexif INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_permissions mediumtext(16777215) NOT NULL DEFAULT '', + user_permissions_changed INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_allow_comments tinyint(1) NOT NULL DEFAULT '1', + subscribe_pegas tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id) +); + +CREATE INDEX phpbb_gallery_users_pega ON phpbb_gallery_users (personal_album_id); + +# Table: 'phpbb_gallery_watch' +CREATE TABLE phpbb_gallery_watch ( + watch_id INTEGER PRIMARY KEY NOT NULL , + album_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + image_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_gallery_watch_uid ON phpbb_gallery_watch (user_id); +CREATE INDEX phpbb_gallery_watch_id ON phpbb_gallery_watch (image_id); +CREATE INDEX phpbb_gallery_watch_aid ON phpbb_gallery_watch (album_id); + + +COMMIT; \ No newline at end of file diff --git a/tests/systemtests/base_database_test.php b/tests/systemtests/base_database_test.php new file mode 100644 index 00000000..753605bc --- /dev/null +++ b/tests/systemtests/base_database_test.php @@ -0,0 +1,34 @@ +createXMLDataSet(dirname(__FILE__) . '/fixtures/basetests.xml'); + } + + public function test_check() + { + $sql = 'SELECT session_user_id, album_name + FROM phpbb_sessions s + LEFT JOIN phpbb_gallery_albums a + ON (s.session_album_id = a.album_id)'; + $result = $this->db->sql_query($sql); + $this->assertEquals(array( + array( + 'session_user_id' => 4, + 'album_name' => 'Testalbum', + ), + ), $this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); + } +} diff --git a/tests/systemtests/base_test.php b/tests/systemtests/base_test.php new file mode 100644 index 00000000..3bd223f4 --- /dev/null +++ b/tests/systemtests/base_test.php @@ -0,0 +1,18 @@ +assertTrue(true); + } +} diff --git a/tests/systemtests/fixtures/basetests.xml b/tests/systemtests/fixtures/basetests.xml new file mode 100644 index 00000000..2292db09 --- /dev/null +++ b/tests/systemtests/fixtures/basetests.xml @@ -0,0 +1,31 @@ + + + + session_id + session_user_id + session_album_id + session_ip + session_browser + session_admin + + bar_session000000000000000000000 + 4 + 42 + 127.0.0.1 + user agent + 1 + +
+ + album_id + album_name + album_parents + album_desc + + 42 + Testalbum + + + +
+
diff --git a/tests/test_config.sample.php b/tests/test_config.sample.php new file mode 100644 index 00000000..c50fe3ef --- /dev/null +++ b/tests/test_config.sample.php @@ -0,0 +1,7 @@ +db = $this->new_dbal(); + } + + protected function create_connection_manager($config) + { + return new \phpbbgallery\core\tests\testframework\database_test_connection_manager($config); + } + + public function get_database_config() + { + $config = \phpbbgallery\core\tests\testframework\test_case_helpers::get_test_config(); + + if (!isset($config['dbms'])) + { + $this->markTestSkipped('Missing test_config.php: See first error.'); + } + + return $config; + } + + public function get_test_case_helpers() + { + if (!$this->test_case_helpers) + { + $this->test_case_helpers = new \phpbbgallery\core\tests\testframework\test_case_helpers($this); + } + + return $this->test_case_helpers; + } +} diff --git a/tests/testframework/database_test_connection_manager.php b/tests/testframework/database_test_connection_manager.php new file mode 100644 index 00000000..4c88c2b7 --- /dev/null +++ b/tests/testframework/database_test_connection_manager.php @@ -0,0 +1,22 @@ +ensure_connected(__METHOD__); + + $directory = dirname(__FILE__) . '/../schemas/'; + $this->load_schema_from_file($directory); + + } +} diff --git a/tests/testframework/functional_test_case.php b/tests/testframework/functional_test_case.php new file mode 100644 index 00000000..650b206a --- /dev/null +++ b/tests/testframework/functional_test_case.php @@ -0,0 +1,14 @@ +test_case_helpers) + { + $this->test_case_helpers = new \phpbbgallery\core\tests\testframework\test_case_helpers($this); + } + + return $this->test_case_helpers; + } +} diff --git a/tests/testframework/test_case_helpers.php b/tests/testframework/test_case_helpers.php new file mode 100644 index 00000000..d3e4430d --- /dev/null +++ b/tests/testframework/test_case_helpers.php @@ -0,0 +1,116 @@ +=')) + { + $config = array_merge($config, array( + 'dbms' => 'phpbb_db_driver_sqlite', + 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + )); + } + + if (isset($_SERVER['PHPBB_TEST_CONFIG'])) + { + // Could be an absolute path + $test_config = $_SERVER['PHPBB_TEST_CONFIG']; + } + else + { + $test_config = dirname(__FILE__) . '/../test_config.php'; + } + + if (file_exists($test_config)) + { + include($test_config); + + if (!function_exists('phpbb_convert_30_dbms_to_31')) + { + global $phpbb_root_path; + require_once $phpbb_root_path . 'includes/functions.php'; + } + + $config = array_merge($config, array( + 'dbms' => phpbb_convert_30_dbms_to_31($dbms), + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + 'custom_dsn' => isset($custom_dsn) ? $custom_dsn : '', + )); + + if (isset($phpbb_functional_url)) + { + $config['phpbb_functional_url'] = $phpbb_functional_url; + } + + if (isset($phpbb_redis_host)) + { + $config['redis_host'] = $phpbb_redis_host; + } + if (isset($phpbb_redis_port)) + { + $config['redis_port'] = $phpbb_redis_port; + } + } + + if (isset($_SERVER['PHPBB_TEST_DBMS'])) + { + if (!function_exists('phpbb_convert_30_dbms_to_31')) + { + global $phpbb_root_path; + require_once $phpbb_root_path . 'includes/functions.php'; + } + + $config = array_merge($config, array( + 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? phpbb_convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '', + 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', + 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', + 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', + 'dbuser' => isset($_SERVER['PHPBB_TEST_DBUSER']) ? $_SERVER['PHPBB_TEST_DBUSER'] : '', + 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '', + 'custom_dsn' => isset($_SERVER['PHPBB_TEST_CUSTOM_DSN']) ? $_SERVER['PHPBB_TEST_CUSTOM_DSN'] : '', + )); + } + + if (isset($_SERVER['PHPBB_FUNCTIONAL_URL'])) + { + $config = array_merge($config, array( + 'phpbb_functional_url' => isset($_SERVER['PHPBB_FUNCTIONAL_URL']) ? $_SERVER['PHPBB_FUNCTIONAL_URL'] : '', + )); + } + + if (isset($_SERVER['PHPBB_TEST_REDIS_HOST'])) + { + $config['redis_host'] = $_SERVER['PHPBB_TEST_REDIS_HOST']; + } + + if (isset($_SERVER['PHPBB_TEST_REDIS_PORT'])) + { + $config['redis_port'] = $_SERVER['PHPBB_TEST_REDIS_PORT']; + } + + return $config; + } +} diff --git a/travis/install-php-extensions.sh b/travis/install-php-extensions.sh new file mode 100755 index 00000000..55955c29 --- /dev/null +++ b/travis/install-php-extensions.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# @copyright (c) 2013 phpBB Group +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# +set -e + +function add_ext_to_php_ini +{ + echo "extension=$1.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` +} + +# redis +git clone git://github.com/nicolasff/phpredis.git +cd phpredis +phpize +./configure +make +make install +cd .. +add_ext_to_php_ini 'redis' diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml new file mode 100644 index 00000000..d875a5ed --- /dev/null +++ b/travis/phpunit-mysql-travis.xml @@ -0,0 +1,41 @@ + + + + + ../tests/ + tests/functional + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml new file mode 100644 index 00000000..52f18c94 --- /dev/null +++ b/travis/phpunit-postgres-travis.xml @@ -0,0 +1,43 @@ + + + + + ../tests/ + tests/functional + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + + diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh new file mode 100755 index 00000000..af5a781b --- /dev/null +++ b/travis/setup-webserver.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# @copyright (c) 2013 phpBB Group +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# +set -e + +sudo apt-get update -qq +sudo apt-get install -qq nginx realpath + +sudo service nginx stop + +DIR=$(dirname "$0") +PHPBB_ROOT_PATH=$(realpath "$DIR/../../../..") + +NGINX_CONF="/etc/nginx/sites-enabled/default" + +PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" +PHP_FPM_CONF="$DIR/php-fpm.conf" +PHP_FPM_SOCK=$(realpath "$DIR")/php-fpm.sock + +USER=$(whoami) + +# php-fpm configuration +echo " +[global] + +[travis] +user = $USER +group = $USER +listen = $PHP_FPM_SOCK +pm = static +pm.max_children = 2 + +php_admin_value[memory_limit] = 128M +" > $PHP_FPM_CONF + +# nginx configuration +echo " +server { + listen 80; + root $PHPBB_ROOT_PATH/; + index index.php index.html; + + location ~ \.php$ { + fastcgi_pass unix:$PHP_FPM_SOCK; + include fastcgi_params; + } +} +" | sudo tee $NGINX_CONF > /dev/null + +# Start daemons +sudo $PHP_FPM_BIN --fpm-config "$DIR/php-fpm.conf" +sudo service nginx start From c3066e6f015edd84f24b052574340a0a97133d9c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:03:59 +0100 Subject: [PATCH 2/8] [feature/tests] Add simple function test --- tests/functions/simple_test.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/functions/simple_test.php diff --git a/tests/functions/simple_test.php b/tests/functions/simple_test.php new file mode 100644 index 00000000..7560d50e --- /dev/null +++ b/tests/functions/simple_test.php @@ -0,0 +1,19 @@ +assertEquals('
woot
  • test
', ap_validate('
woot
  • test

')); + } + +} From fe7794f81a65f3be79717db21bf73ee6739d3b3e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:12:24 +0100 Subject: [PATCH 3/8] [feature/tests] Fix testframework for board3 portal --- tests/bootstrap.php | 2 +- tests/systemtests/base_database_test.php | 4 ++-- tests/systemtests/base_test.php | 4 ++-- tests/testframework/database_test_case.php | 8 ++++---- tests/testframework/database_test_connection_manager.php | 2 +- tests/testframework/functional_test_case.php | 2 +- tests/testframework/test_case.php | 4 ++-- tests/testframework/test_case_helpers.php | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 497654eb..abd06207 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -8,7 +8,7 @@ */ define('IN_PHPBB', true); -$phpbb_root_path = '../../../'; +$phpbb_root_path = './../../'; $phpEx = 'php'; require_once $phpbb_root_path . 'includes/startup.' . $phpEx; diff --git a/tests/systemtests/base_database_test.php b/tests/systemtests/base_database_test.php index 753605bc..b2ded0c4 100644 --- a/tests/systemtests/base_database_test.php +++ b/tests/systemtests/base_database_test.php @@ -7,9 +7,9 @@ * */ -namespace phpbbgallery\core\tests\systemtests; +namespace board3\tests\systemtests; -class base_database_test extends \phpbbgallery\core\tests\testframework\database_test_case +class base_database_test extends \board3\tests\testframework\database_test_case { public function getDataSet() { diff --git a/tests/systemtests/base_test.php b/tests/systemtests/base_test.php index 3bd223f4..95040423 100644 --- a/tests/systemtests/base_test.php +++ b/tests/systemtests/base_test.php @@ -7,9 +7,9 @@ * */ -namespace phpbbgallery\core\tests\systemtests; +namespace board3\tests\systemtests; -class base_test extends \phpbbgallery\core\tests\testframework\test_case +class base_test extends \board3\tests\testframework\test_case { public function test_check() { diff --git a/tests/testframework/database_test_case.php b/tests/testframework/database_test_case.php index fcdf0261..12a15763 100644 --- a/tests/testframework/database_test_case.php +++ b/tests/testframework/database_test_case.php @@ -7,7 +7,7 @@ * */ -namespace phpbbgallery\core\tests\testframework; +namespace board3\tests\testframework; abstract class database_test_case extends \phpbb_database_test_case { @@ -23,12 +23,12 @@ abstract class database_test_case extends \phpbb_database_test_case protected function create_connection_manager($config) { - return new \phpbbgallery\core\tests\testframework\database_test_connection_manager($config); + return new \board3\tests\testframework\database_test_connection_manager($config); } public function get_database_config() { - $config = \phpbbgallery\core\tests\testframework\test_case_helpers::get_test_config(); + $config = \board3\tests\testframework\test_case_helpers::get_test_config(); if (!isset($config['dbms'])) { @@ -42,7 +42,7 @@ abstract class database_test_case extends \phpbb_database_test_case { if (!$this->test_case_helpers) { - $this->test_case_helpers = new \phpbbgallery\core\tests\testframework\test_case_helpers($this); + $this->test_case_helpers = new \board3\tests\testframework\test_case_helpers($this); } return $this->test_case_helpers; diff --git a/tests/testframework/database_test_connection_manager.php b/tests/testframework/database_test_connection_manager.php index 4c88c2b7..d478dd9d 100644 --- a/tests/testframework/database_test_connection_manager.php +++ b/tests/testframework/database_test_connection_manager.php @@ -7,7 +7,7 @@ * */ -namespace phpbbgallery\core\tests\testframework; +namespace board3\tests\testframework; class database_test_connection_manager extends \phpbb_database_test_connection_manager { diff --git a/tests/testframework/functional_test_case.php b/tests/testframework/functional_test_case.php index 650b206a..62b51b66 100644 --- a/tests/testframework/functional_test_case.php +++ b/tests/testframework/functional_test_case.php @@ -7,7 +7,7 @@ * */ -namespace phpbbgallery\core\tests\testframework; +namespace board3\tests\testframework; abstract class functional_test_case extends \phpbb_functional_test_case { diff --git a/tests/testframework/test_case.php b/tests/testframework/test_case.php index f9c4b240..9ec1c53e 100644 --- a/tests/testframework/test_case.php +++ b/tests/testframework/test_case.php @@ -7,7 +7,7 @@ * */ -namespace phpbbgallery\core\tests\testframework; +namespace board3\tests\testframework; abstract class test_case extends \phpbb_test_case { @@ -15,7 +15,7 @@ abstract class test_case extends \phpbb_test_case { if (!$this->test_case_helpers) { - $this->test_case_helpers = new \phpbbgallery\core\tests\testframework\test_case_helpers($this); + $this->test_case_helpers = new \board3\tests\testframework\test_case_helpers($this); } return $this->test_case_helpers; diff --git a/tests/testframework/test_case_helpers.php b/tests/testframework/test_case_helpers.php index d3e4430d..b699569f 100644 --- a/tests/testframework/test_case_helpers.php +++ b/tests/testframework/test_case_helpers.php @@ -7,7 +7,7 @@ * */ -namespace phpbbgallery\core\tests\testframework; +namespace board3\tests\testframework; abstract class test_case_helpers extends \phpbb_test_case_helpers { From 4eb836cbc727c73b7e95581a74df95272d6d9ce0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:19:37 +0100 Subject: [PATCH 4/8] [feature/tests] fix travis build --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c7c7d42..7cbcc67f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,15 +14,15 @@ before_script: - cd ../../ - git clone "git://github.com/phpbb/phpbb3.git" "phpBB3" - mkdir phpBB3/phpBB/ext - - mkdir phpBB3/phpBB/ext/phpbbgallery - - mv nickvergessen/phpbb3-ext-gallery phpBB3/phpBB/ext/phpbbgallery/core + - mkdir phpBB3/phpBB/ext/board3 + - mv board3/Board3-Portal phpBB3/phpBB/ext/board3 # Setup the dependencies - cd phpBB3/phpBB - php ../composer.phar install --dev --no-interaction --prefer-source # Setup the tests/travis - - cd ext/phpbbgallery/core + - cd ext/board3 - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" @@ -37,5 +37,6 @@ notifications: email: recipients: - nickvergessen@gmx.de + - admin@m-a-styles.de on_success: change on_failure: change From 27304eb644940af951b5df2c58c1523320d43d73 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:32:30 +0100 Subject: [PATCH 5/8] [feature/tests] Correctly move Board3-Portal on any repository --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7cbcc67f..dd360e58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,8 @@ before_script: - git clone "git://github.com/phpbb/phpbb3.git" "phpBB3" - mkdir phpBB3/phpBB/ext - mkdir phpBB3/phpBB/ext/board3 - - mv board3/Board3-Portal phpBB3/phpBB/ext/board3 + - find -type d -name "Board3-Portal" -print | xargs -i mv {} phpBB3/phpBB/ext/board3 + # - mv board3/Board3-Portal phpBB3/phpBB/ext/board3 # Setup the dependencies - cd phpBB3/phpBB From 88dd50f3ab1f91a0078cc728d18354caec6d2b31 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:35:18 +0100 Subject: [PATCH 6/8] [feature/tests] show dir content before failure --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd360e58..4766637c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ before_script: - cd ../../ - git clone "git://github.com/phpbb/phpbb3.git" "phpBB3" - mkdir phpBB3/phpBB/ext - - mkdir phpBB3/phpBB/ext/board3 + # - mkdir phpBB3/phpBB/ext/board3 - find -type d -name "Board3-Portal" -print | xargs -i mv {} phpBB3/phpBB/ext/board3 # - mv board3/Board3-Portal phpBB3/phpBB/ext/board3 @@ -27,6 +27,7 @@ before_script: - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" + - ls -l - travis/install-php-extensions.sh - phpenv rehash - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" From 5263e67fa87bc21444408d65d9bf9198eeb406d2 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:52:11 +0100 Subject: [PATCH 7/8] [feature/tests] use correct link to phpunit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4766637c..e2cfa2c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_script: - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" script: - - ../../../vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml + - ../../vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml notifications: email: From e7413d417df461060042946877a5ef6103a45893 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 29 Oct 2013 15:59:52 +0100 Subject: [PATCH 8/8] [feature/tests] fix tests for not defined PHPUnit_Runner_Version --- tests/testframework/test_case_helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testframework/test_case_helpers.php b/tests/testframework/test_case_helpers.php index b699569f..5988029a 100644 --- a/tests/testframework/test_case_helpers.php +++ b/tests/testframework/test_case_helpers.php @@ -18,7 +18,7 @@ abstract class test_case_helpers extends \phpbb_test_case_helpers { $config = array(); - if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + if (extension_loaded('sqlite') && version_compare(\PHPUnit_Runner_Version::id(), '3.4.15', '>=')) { $config = array_merge($config, array( 'dbms' => 'phpbb_db_driver_sqlite',