1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[feature/migrations] Migrations now somewhat works

PHPBB3-9737
This commit is contained in:
Nathan Guse
2013-01-08 22:09:14 -06:00
parent 826607a405
commit 5c91e2569c
44 changed files with 1375 additions and 3419 deletions

View File

@@ -1521,8 +1521,6 @@ function change_database_data(&$no_updates, $version)
),
);
global $db_tools;
$statements = $db_tools->perform_schema_changes($changes);
foreach ($statements as $sql)
@@ -2164,26 +2162,41 @@ function change_database_data(&$no_updates, $version)
}
$db->sql_freeresult($result);
global $db_tools, $table_prefix;
// Recover from potentially broken Q&A CAPTCHA table on firebird
// Q&A CAPTCHA was uninstallable, so it's safe to remove these
// without data loss
/*
* Due to a bug, vanilla phpbb could not create captcha tables
* in 3.0.8 on firebird. It was possible for board administrators
* to adjust the code to work. If code was manually adjusted by
* board administrators, index names would not be the same as
* what 3.0.9 and newer expect. This code fragment drops captcha
* tables, destroying all entered Q&A captcha configuration, such
* that when Q&A is configured next the respective tables will be
* created with correct index names.
*
* If you wish to preserve your Q&A captcha configuration, you can
* manually rename indexes to the currently expected name:
* phpbb_captcha_questions_lang_iso => phpbb_captcha_questions_lang
* phpbb_captcha_answers_question_id => phpbb_captcha_answers_qid
*
* Again, this needs to be done only if a board was manually modified
* to fix broken captcha code.
*
if ($db_tools->sql_layer == 'firebird')
{
$tables = array(
$table_prefix . 'captcha_questions',
$table_prefix . 'captcha_answers',
$table_prefix . 'qa_confirm',
$changes = array(
'drop_tables' => array(
$table_prefix . 'captcha_questions',
$table_prefix . 'captcha_answers',
$table_prefix . 'qa_confirm',
),
);
foreach ($tables as $table)
$statements = $db_tools->perform_schema_changes($changes);
foreach ($statements as $sql)
{
if ($db_tools->sql_table_exists($table))
{
$db_tools->sql_table_drop($table);
}
_sql($sql, $errored, $error_ary);
}
}
*/
$no_updates = false;
break;
@@ -2360,6 +2373,26 @@ function change_database_data(&$no_updates, $version)
}
}
// Disable receiving pms for bots
$sql = 'SELECT user_id
FROM ' . BOTS_TABLE;
$result = $db->sql_query($sql);
$bot_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$bot_user_ids[] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
if (!empty($bot_user_ids))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_allow_pm = 0
WHERE ' . $db->sql_in_set('user_id', $bot_user_ids);
_sql($sql, $errored, $error_ary);
}
$no_updates = false;
break;

View File

@@ -573,18 +573,6 @@ CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwar
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_migrations'
CREATE TABLE phpbb_migrations (
migration_name VARCHAR(255) 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
);;
CREATE UNIQUE INDEX phpbb_migrations_migration_name ON phpbb_migrations(migration_name);;
# Table: 'phpbb_moderator_cache'
CREATE TABLE phpbb_moderator_cache (
forum_id INTEGER DEFAULT 0 NOT NULL,
@@ -598,6 +586,19 @@ CREATE TABLE phpbb_moderator_cache (
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_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,
@@ -924,8 +925,8 @@ CREATE TABLE phpbb_reports (
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_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
reported_post_uid VARCHAR(8) CHARACTER SET NONE 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
);;
ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);;

View File

@@ -696,23 +696,6 @@ CREATE INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY]
GO
/*
Table: 'phpbb_migrations'
*/
CREATE TABLE [phpbb_migrations] (
[migration_name] [varchar] (255) 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
CREATE UNIQUE INDEX [migration_name] ON [phpbb_migrations]([migration_name]) ON [PRIMARY]
GO
/*
Table: 'phpbb_moderator_cache'
*/
@@ -733,6 +716,27 @@ 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_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'
*/
@@ -1128,8 +1132,8 @@ CREATE TABLE [phpbb_reports] (
[report_time] [int] DEFAULT (0) NOT NULL ,
[report_text] [text] DEFAULT ('') NOT NULL ,
[reported_post_text] [text] DEFAULT ('') NOT NULL ,
[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL ,
[reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL
[reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL ,
[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

View File

@@ -397,18 +397,6 @@ CREATE TABLE phpbb_login_attempts (
);
# Table: 'phpbb_migrations'
CREATE TABLE phpbb_migrations (
migration_name varbinary(255) DEFAULT '' 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,
UNIQUE migration_name (migration_name)
);
# Table: 'phpbb_moderator_cache'
CREATE TABLE phpbb_moderator_cache (
forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@@ -422,6 +410,18 @@ CREATE TABLE phpbb_moderator_cache (
);
# Table: 'phpbb_migrations'
CREATE TABLE phpbb_migrations (
migration_name varbinary(255) DEFAULT '' 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,
@@ -661,8 +661,8 @@ CREATE TABLE phpbb_reports (
report_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
report_text mediumblob NOT NULL,
reported_post_text mediumblob NOT NULL,
reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL,
reported_post_uid varbinary(8) DEFAULT '' NOT NULL,
reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL,
PRIMARY KEY (report_id),
KEY post_id (post_id),
KEY pm_id (pm_id)

View File

@@ -397,18 +397,6 @@ CREATE TABLE phpbb_login_attempts (
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_migrations'
CREATE TABLE phpbb_migrations (
migration_name varchar(255) DEFAULT '' 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,
UNIQUE migration_name (migration_name)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_moderator_cache'
CREATE TABLE phpbb_moderator_cache (
forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@@ -422,6 +410,18 @@ CREATE TABLE phpbb_moderator_cache (
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_migrations'
CREATE TABLE phpbb_migrations (
migration_name varchar(255) DEFAULT '' 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,
@@ -661,8 +661,8 @@ CREATE TABLE phpbb_reports (
report_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
report_text mediumtext NOT NULL,
reported_post_text mediumtext NOT NULL,
reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
reported_post_uid varchar(8) DEFAULT '' NOT NULL,
reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (report_id),
KEY post_id (post_id),
KEY pm_id (pm_id)

View File

@@ -780,21 +780,6 @@ 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_migrations'
*/
CREATE TABLE phpbb_migrations (
migration_name varchar2(255) 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 u_phpbb_migration_name UNIQUE (migration_name)
)
/
/*
Table: 'phpbb_moderator_cache'
*/
@@ -813,6 +798,21 @@ CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on
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_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'
*/
@@ -1231,8 +1231,8 @@ CREATE TABLE phpbb_reports (
report_time number(11) DEFAULT '0' NOT NULL,
report_text clob DEFAULT '' ,
reported_post_text clob DEFAULT '' ,
reported_post_bitfield varchar2(255) DEFAULT '' ,
reported_post_uid varchar2(8) DEFAULT '' ,
reported_post_bitfield varchar2(255) DEFAULT '' ,
CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id)
)
/

View File

@@ -557,20 +557,6 @@ CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwa
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_migrations'
*/
CREATE TABLE phpbb_migrations (
migration_name varchar(255) 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)
);
CREATE UNIQUE INDEX phpbb_migrations_migration_name ON phpbb_migrations (migration_name);
/*
Table: 'phpbb_moderator_cache'
*/
@@ -586,6 +572,20 @@ CREATE TABLE phpbb_moderator_cache (
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_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'
*/
@@ -869,8 +869,8 @@ CREATE TABLE phpbb_reports (
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_bitfield varchar(255) DEFAULT '' NOT NULL,
reported_post_uid varchar(8) DEFAULT '' NOT NULL,
reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (report_id)
);

View File

@@ -385,18 +385,6 @@ CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwa
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_migrations'
CREATE TABLE phpbb_migrations (
migration_name varchar(255) 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'
);
CREATE UNIQUE INDEX phpbb_migrations_migration_name ON phpbb_migrations (migration_name);
# Table: 'phpbb_moderator_cache'
CREATE TABLE phpbb_moderator_cache (
forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
@@ -410,6 +398,18 @@ CREATE TABLE phpbb_moderator_cache (
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_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 ,
@@ -642,8 +642,8 @@ CREATE TABLE phpbb_reports (
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_bitfield varchar(255) NOT NULL DEFAULT '',
reported_post_uid varchar(8) NOT NULL DEFAULT ''
reported_post_uid varchar(8) NOT NULL DEFAULT '',
reported_post_bitfield varchar(255) NOT NULL DEFAULT ''
);
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);