Merge "Drop database patches for MW < 1.27"

This commit is contained in:
jenkins-bot 2021-04-17 15:00:26 +00:00 committed by Gerrit Code Review
commit 8a7511c5d2
17 changed files with 0 additions and 372 deletions

View file

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

View file

@ -1,4 +0,0 @@
UPDATE /*_*/abuse_filter_log SET afl_deleted = 0 WHERE afl_deleted IS NULL;
UPDATE /*_*/abuse_filter_log SET afl_patrolled_by = 0 WHERE afl_patrolled_by IS NULL;
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_deleted tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE /*_*/abuse_filter_log MODIFY afl_patrolled_by int unsigned NOT NULL DEFAULT 0;

View file

@ -1,18 +0,0 @@
-- Fixes abuse_filter_log indices.
--# PRIMARY KEY (afl_id),
--# KEY (afl_filter,afl_timestamp),
--# KEY (afl_user,afl_user_text,afl_timestamp),
--# KEY (afl_timestamp),
--# KEY (afl_namespace, afl_title, afl_timestamp),
--# KEY (afl_ip, afl_timestamp)
ALTER TABLE /*_*/abuse_filter_log ADD KEY filter_timestamp (afl_filter,afl_timestamp);
ALTER TABLE /*_*/abuse_filter_log ADD KEY user_timestamp (afl_user,afl_user_text,afl_timestamp);
ALTER TABLE /*_*/abuse_filter_log ADD KEY page_timestamp (afl_namespace, afl_title, afl_timestamp);
ALTER TABLE /*_*/abuse_filter_log ADD KEY ip_timestamp (afl_ip, afl_timestamp);
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_filter;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_user;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_namespace;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_ip;

View file

@ -1,18 +0,0 @@
-- Patch to add abuse_filter_history table
CREATE TABLE /*$wgDBprefix*/abuse_filter_history (
afh_id BIGINT unsigned NOT NULL AUTO_INCREMENT,
afh_filter BIGINT unsigned NOT NULL,
afh_user BIGINT unsigned NOT NULL,
afh_user_text varchar(255) binary NOT NULL,
afh_timestamp binary(14) NOT NULL,
afh_pattern BLOB NOT NULL,
afh_comments BLOB NOT NULL,
afh_flags TINYBLOB NOT NULL,
afh_public_comments TINYBLOB,
afh_actions BLOB
) /*$wgDBTableOptions*/;
CREATE INDEX afh_filter ON /*$wgDBprefix*/abuse_filter_history (afh_filter);
CREATE INDEX afh_user ON /*$wgDBprefix*/abuse_filter_history (afh_user);
CREATE INDEX afh_user_text ON /*$wgDBprefix*/abuse_filter_history (afh_user_text);
CREATE INDEX afh_timestamp ON /*$wgDBprefix*/abuse_filter_history (afh_timestamp);

View file

@ -1,4 +0,0 @@
--- Adds an af_actions field to the abuse_filter table, so we don't need to LEFT JOIN on abuse_filter_action and use a GROUP_CONCAT, which isn't compatible with mysql 4.0
--- Andrew Garrett, 2009-01-27
ALTER TABLE /*_*/abuse_filter add column af_actions varchar(255) NOT NULL DEFAULT '';

View file

@ -1,2 +0,0 @@
ALTER TABLE /*_*/abuse_filter ADD COLUMN af_deleted tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE /*_*/abuse_filter_history ADD COLUMN afh_deleted tinyint(1) NOT NULL DEFAULT 0;

View file

@ -1,5 +0,0 @@
-- Add af_group field to abuse_filter table
ALTER TABLE /*_*/abuse_filter add column af_group varchar(64) binary NOT NULL DEFAULT 'default';
ALTER TABLE /*_*/abuse_filter_history add column afh_group varchar(64) binary NULL;
CREATE INDEX /*i*/af_group ON /*_*/abuse_filter (af_group,af_enabled,af_id);

View file

@ -1,3 +0,0 @@
--- 2009-01-26, Andrew Garrett
--- Adds a 'changed fields' field to the abuse filter history, so that we can highlight fields which changed!
ALTER TABLE /*_*/abuse_filter_history add column afh_changed_fields varchar(255) NOT NULL DEFAULT '';

View file

@ -1,4 +0,0 @@
-- Store the ID of successful actions in the abuse_filter_log table.
ALTER TABLE /*_*/abuse_filter_log
ADD COLUMN afl_rev_id int unsigned;
CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id);

View file

@ -1,6 +0,0 @@
-- Patch to add support for global filters
ALTER TABLE /*_*/abuse_filter ADD COLUMN af_global tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE /*_*/abuse_filter_log ADD COLUMN afl_wiki varchar(64) binary NULL;
ALTER TABLE /*_*/abuse_filter_log CHANGE COLUMN afl_filter afl_filter varchar(64) binary NOT NULL;

View file

@ -1,3 +0,0 @@
-- Add abuse_filter_log index for afl_wiki.
CREATE INDEX afl_wiki_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_wiki, afl_timestamp);

View file

@ -1,5 +0,0 @@
-- Add hiding and patrolling ability to abuse filter log
-- Andrew Garrett, June 2009
ALTER TABLE /*_*/abuse_filter_log ADD COLUMN afl_deleted tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE /*_*/abuse_filter_log ADD COLUMN afl_patrolled_by int unsigned NOT NULL DEFAULT 0;

View file

@ -1,29 +0,0 @@
-- Patch to add abuse_filter_history table (Postgres version)
BEGIN;
CREATE SEQUENCE abuse_filter_history_afh_id_seq;
CREATE TABLE abuse_filter_history (
afh_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('abuse_filter_history_afh_id_seq'),
afh_filter INTEGER NOT NULL,
afh_user INTEGER NOT NULL,
afh_user_text TEXT NOT NULL,
afh_timestamp TIMESTAMPTZ NOT NULL,
afh_pattern TEXT NOT NULL,
afh_comments TEXT NOT NULL,
afh_flags TEXT NOT NULL,
afh_public_comments TEXT NOT NULL,
afh_actions TEXT NOT NULL,
afh_deleted SMALLINT NOT NULL DEFAULT 0,
afh_changed_fields TEXT NOT NULL DEFAULT ''
);
CREATE INDEX abuse_filter_history_filter ON abuse_filter_history(afh_filter);
CREATE INDEX abuse_filter_history_user ON abuse_filter_history(afh_user);
CREATE INDEX abuse_filter_history_user_text ON abuse_filter_history(afh_user_text);
CREATE INDEX abuse_filter_history_timestamp ON abuse_filter_history(afh_timestamp);
COMMIT;

View file

@ -1,43 +0,0 @@
-- (Just) change afl_namespace field to int NOT NULL.
BEGIN;
DROP TABLE IF EXISTS /*_*/abuse_filter_log_tmp;
CREATE TABLE /*_*/abuse_filter_log_tmp (
afl_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
afl_filter varbinary(64) NOT NULL,
afl_user BIGINT unsigned NOT NULL,
afl_user_text varbinary(255) NOT NULL,
afl_ip varbinary(255) not null,
afl_action varbinary(255) not null,
afl_actions varbinary(255) not null,
afl_var_dump BLOB NOT NULL,
afl_timestamp varbinary(14) NOT NULL,
afl_namespace int NOT NULL,
afl_title varbinary(255) NOT NULL,
afl_wiki varbinary(64) NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
afl_patrolled_by int unsigned NULL,
afl_rev_id int unsigned
) /*$wgDBTableOptions*/;
INSERT OR IGNORE INTO /*_*/abuse_filter_log_tmp (
afl_id, afl_filter, afl_user, afl_user_text, afl_ip, afl_action, afl_actions,
afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki, afl_deleted,
afl_patrolled_by, afl_rev_id)
SELECT afl_id, afl_filter, afl_user, afl_user_text, afl_ip, afl_action, afl_actions,
afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki, afl_deleted,
afl_patrolled_by, afl_rev_id
FROM /*_*/abuse_filter_log;
DROP TABLE /*_*/abuse_filter_log;
ALTER TABLE /*_*/abuse_filter_log_tmp RENAME TO /*_*/abuse_filter_log;
CREATE INDEX /*i*/afl_filter_timestamp ON /*_*/abuse_filter_log (afl_filter,afl_timestamp);
CREATE INDEX /*i*/afl_user_timestamp ON /*_*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp);
CREATE INDEX /*i*/afl_timestamp ON /*_*/abuse_filter_log (afl_timestamp);
CREATE INDEX /*i*/afl_page_timestamp ON /*_*/abuse_filter_log (afl_namespace, afl_title, afl_timestamp);
CREATE INDEX /*i*/afl_ip_timestamp ON /*_*/abuse_filter_log (afl_ip, afl_timestamp);
CREATE INDEX /*i*/afl_wiki_timestamp ON /*_*/abuse_filter_log (afl_wiki, afl_timestamp);
CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id);
COMMIT;

View file

@ -1,48 +0,0 @@
BEGIN;
DROP TABLE IF EXISTS /*_*/abuse_filter_log_tmp;
CREATE TABLE /*_*/abuse_filter_log_tmp (
afl_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
afl_filter varbinary(64) NOT NULL DEFAULT '',
afl_global tinyint(1) NOT NULL DEFAULT 0,
afl_filter_id INTEGER NOT NULL DEFAULT 0,
afl_user BIGINT unsigned NOT NULL,
afl_user_text varbinary(255) NOT NULL,
afl_ip varbinary(255) not null,
afl_action varbinary(255) not null,
afl_actions varbinary(255) not null,
afl_var_dump BLOB NOT NULL,
afl_timestamp varbinary(14) NOT NULL,
afl_namespace int NOT NULL,
afl_title varbinary(255) NOT NULL,
afl_wiki varbinary(64) NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
afl_patrolled_by int unsigned NOT NULL DEFAULT 0,
afl_rev_id int unsigned
) /*$wgDBTableOptions*/;
INSERT INTO abuse_filter_log_tmp
SELECT afl_id, afl_filter, afl_global, afl_filter_id, afl_user, afl_user_text, afl_ip, afl_action,
afl_actions, afl_var_dump, afl_timestamp, afl_namespace, afl_title, afl_wiki,
IFNULL(afl_deleted, 0),
IFNULL(afl_patrolled_by, 0),
afl_rev_id
FROM /*_*/abuse_filter_log;
DROP TABLE /*_*/abuse_filter_log;
ALTER TABLE /*_*/abuse_filter_log_tmp RENAME TO /*_*/abuse_filter_log;
CREATE INDEX /*i*/afl_filter_timestamp ON /*_*/abuse_filter_log (afl_filter,afl_timestamp);
CREATE INDEX /*i*/afl_filter_timestamp_full ON /*_*/abuse_filter_log (afl_global,afl_filter_id,afl_timestamp);
CREATE INDEX /*i*/afl_user_timestamp ON /*_*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp);
CREATE INDEX /*i*/afl_timestamp ON /*_*/abuse_filter_log (afl_timestamp);
CREATE INDEX /*i*/afl_page_timestamp ON /*_*/abuse_filter_log (afl_namespace, afl_title, afl_timestamp);
CREATE INDEX /*i*/afl_ip_timestamp ON /*_*/abuse_filter_log (afl_ip, afl_timestamp);
CREATE INDEX /*i*/afl_wiki_timestamp ON /*_*/abuse_filter_log (afl_wiki, afl_timestamp);
CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id);
COMMIT;

View file

@ -1,18 +0,0 @@
-- Fixes abuse_filter_log indices.
--# PRIMARY KEY (afl_id),
--# KEY (afl_filter,afl_timestamp),
--# KEY (afl_user,afl_user_text,afl_timestamp),
--# KEY (afl_timestamp),
--# KEY (afl_namespace, afl_title, afl_timestamp),
--# KEY (afl_ip, afl_timestamp)
CREATE INDEX afl_filter_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_filter,afl_timestamp);
CREATE INDEX afl_user_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp);
CREATE INDEX afl_page_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_namespace, afl_title, afl_timestamp);
CREATE INDEX afl_ip_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_ip, afl_timestamp);
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_filter;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_user;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_namespace;
ALTER TABLE /*_*/abuse_filter_log DROP KEY afl_ip;

View file

@ -59,65 +59,7 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {
"$dir/$dbType/abusefilter.sql"
);
$updater->addExtensionTable(
'abuse_filter_history',
"$dir/$dbType/patch-abuse_filter_history.sql"
);
if ( $dbType === 'mysql' || $dbType === 'sqlite' ) {
$updater->addExtensionField(
'abuse_filter_history',
'afh_changed_fields',
"$dir/patch-afh_changed_fields.sql"
);
$updater->addExtensionField(
'abuse_filter',
'af_deleted',
"$dir/patch-af_deleted.sql"
);
$updater->addExtensionField(
'abuse_filter',
'af_actions',
"$dir/patch-af_actions.sql"
);
$updater->addExtensionField(
'abuse_filter',
'af_global',
"$dir/patch-global_filters.sql"
);
$updater->addExtensionField(
'abuse_filter_log',
'afl_rev_id',
"$dir/patch-afl_action_id.sql"
);
$filterTimestampIdxName = $dbType === 'mysql'
? 'filter_timestamp'
: 'afl_filter_timestamp';
$updater->addExtensionIndex(
'abuse_filter_log',
$filterTimestampIdxName,
"$dir/$dbType/patch-fix-indexes.sql"
);
$updater->addExtensionField(
'abuse_filter',
'af_group',
"$dir/patch-af_group.sql"
);
$updater->addExtensionIndex(
'abuse_filter_log',
'afl_wiki_timestamp',
"$dir/patch-global_logging_wiki-index.sql"
);
$updater->modifyExtensionField(
'abuse_filter_log',
'afl_namespace',
"$dir/$dbType/patch-afl-namespace_int.sql"
);
$updater->dropExtensionField(
'abuse_filter_log',
'afl_log_id',
@ -129,98 +71,7 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {
'filter_timestamp_full',
"$dir/$dbType/patch-split-afl_filter.sql"
);
$updater->modifyExtensionField(
'abuse_filter_log',
'afl_patrolled_by',
"$dir/$dbType/patch-afl_change_deleted_patrolled.sql"
);
} elseif ( $dbType === 'postgres' ) {
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter', 'af_actions', "TEXT NOT NULL DEFAULT ''"
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter', 'af_deleted', 'SMALLINT NOT NULL DEFAULT 0'
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter', 'af_global', 'SMALLINT NOT NULL DEFAULT 0'
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter', 'af_group', "TEXT NOT NULL DEFAULT 'default'"
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter', 'abuse_filter_group_enabled_id',
"(af_group, af_enabled, af_id)"
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_history', 'afh_group', "TEXT"
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_wiki', 'TEXT'
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_deleted', 'SMALLINT'
] );
$updater->addExtensionUpdate( [
'setDefault', 'abuse_filter_log', 'afl_deleted', '0'
] );
$updater->addExtensionUpdate( [
'changeNullableField', 'abuse_filter_log', 'afl_deleted', 'NOT NULL', true
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_patrolled_by', 'INTEGER'
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_rev_id', 'INTEGER'
] );
$updater->addExtensionUpdate( [
'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', ''
] );
$updater->addExtensionUpdate( [
'changeField', 'abuse_filter_log', 'afl_namespace', "INTEGER", ''
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_filter'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_ip'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_title'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_user'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_user_text'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_wiki'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_filter_timestamp',
'(afl_filter,afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_user_timestamp',
'(afl_user,afl_user_text,afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_page_timestamp',
'(afl_namespace,afl_title,afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_ip_timestamp',
'(afl_ip, afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_rev_id',
'(afl_rev_id)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_wiki_timestamp',
'(afl_wiki,afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'dropPgField', 'abuse_filter_log', 'afl_log_id' ] );
$updater->addExtensionUpdate( [
@ -236,18 +87,6 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {
'addPgIndex', 'abuse_filter_log', 'abuse_filter_log_filter_timestamp_full',
'(afl_global, afl_filter_id, afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'setDefault', 'abuse_filter_log', 'afl_deleted', 0
] );
$updater->addExtensionUpdate( [
'changeNullableField', 'abuse_filter_log', 'afl_deleted', 'NOT NULL', true
] );
$updater->addExtensionUpdate( [
'setDefault', 'abuse_filter_log', 'afl_patrolled_by', 0
] );
$updater->addExtensionUpdate( [
'changeNullableField', 'abuse_filter_log', 'afl_patrolled_by', 'NOT NULL', true
] );
}
$updater->addExtensionUpdate( [ [ $this, 'createAbuseFilterUser' ] ] );