abuse_filter_log table only uses tinyint not int for namespace ID

Bug: 31397
Change-Id: Ifb1275798a8dc383d37743fb75b93d162360424c
This commit is contained in:
se4598 2014-01-30 21:27:52 +01:00 committed by Springle
parent b7c95321c3
commit 03f18d2578
5 changed files with 18 additions and 3 deletions

View file

@ -487,6 +487,19 @@ class AbuseFilterHooks {
$updater->addExtensionUpdate( array( 'addIndex', 'abuse_filter_log', 'afl_wiki_timestamp', "$dir/db_patches/patch-global_logging_wiki-index.sqlite.sql", true ) );
}
if ( $updater->getDB()->getType() == 'mysql' ) {
$updater->addExtensionUpdate( array( 'modifyField', 'abuse_filter_log', 'afl_namespace', "$dir/db_patches/patch-afl-namespace_int.sql", true ) );
} else {
//$updater->addExtensionUpdate( array( 'modifyField', 'abuse_filter_log', 'afl_namespace', "$dir/db_patches/patch-afl-namespace_int.sqlite.sql", true ) );
/*
TODO: modify a column in sqlite, which do not support such things
create backup, drop, create with new schema, copy, drop backup
or simply see https://www.mediawiki.org/wiki/Manual:SQLite#About_SQLite :
Several extensions are known to have database update or installation issues with SQLite: AbuseFilter, ...
*/
}
} elseif ( $updater->getDB()->getType() == 'postgres' ) {
$updater->addExtensionUpdate( array( 'addTable', 'abuse_filter', "$dir/abusefilter.tables.pg.sql", true ) );
$updater->addExtensionUpdate( array( 'addTable', 'abuse_filter_history', "$dir/db_patches/patch-abuse_filter_history.pg.sql", true ) );
@ -498,6 +511,7 @@ class AbuseFilterHooks {
$updater->addExtensionUpdate( array( 'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', '' ) );
$updater->addExtensionUpdate( array( 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_ip', "(afl_ip)" ) );
$updater->addExtensionUpdate( array( 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_wiki', "(afl_wiki)" ) );
$updater->addExtensionUpdate( array( 'changeField', 'abuse_filter_log', 'afl_namespace', "INTEGER" ) );
}
$updater->addExtensionUpdate( array( array( __CLASS__, 'createAbuseFilterUser' ) ) );

View file

@ -46,7 +46,7 @@ CREATE TABLE abuse_filter_log (
afl_actions TEXT NOT NULL,
afl_var_dump TEXT NOT NULL,
afl_timestamp TIMESTAMPTZ NOT NULL,
afl_namespace SMALLINT NOT NULL,
afl_namespace INTEGER NOT NULL,
afl_title TEXT NOT NULL,
afl_wiki TEXT NULL,
afl_deleted SMALLINT NULL

View file

@ -41,7 +41,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
afl_actions varbinary(255) not null,
afl_var_dump BLOB NOT NULL,
afl_timestamp binary(14) NOT NULL,
afl_namespace tinyint NOT NULL,
afl_namespace int NOT NULL,
afl_title varchar(255) binary NOT NULL,
afl_wiki varchar(64) binary NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,

View file

@ -37,7 +37,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
afl_actions varbinary(255) not null,
afl_var_dump BLOB NOT NULL,
afl_timestamp binary(14) NOT NULL,
afl_namespace tinyint NOT NULL,
afl_namespace int NOT NULL,
afl_title varchar(255) binary NOT NULL,
afl_wiki varchar(64) binary NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,

View file

@ -0,0 +1 @@
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_namespace INT NOT NULL;