Drop some ancient schema changes

MW <= 1.34

Bug: T353923
Change-Id: Id5fd76857019c4882e31b185c8ba48ef5c1025a8
This commit is contained in:
Reedy 2023-12-22 01:49:51 +00:00
parent f7339cdc82
commit c0a374eab8
5 changed files with 0 additions and 129 deletions

View file

@ -1,2 +0,0 @@
ALTER TABLE /*_*/abuse_filter_log
DROP COLUMN afl_log_id;

View file

@ -1,7 +0,0 @@
-- Split afl_filter into afl_filter_id and afl_global
ALTER TABLE /*_*/abuse_filter_log
ADD COLUMN afl_global tinyint(1) NOT NULL DEFAULT 0 AFTER afl_filter,
ADD COLUMN afl_filter_id BIGINT unsigned NOT NULL DEFAULT 0 AFTER afl_global,
ALTER COLUMN afl_filter SET DEFAULT '';
CREATE INDEX /*i*/afl_filter_timestamp_full ON /*_*/abuse_filter_log (afl_global,afl_filter_id,afl_timestamp);

View file

@ -1,44 +0,0 @@
-- This monster is just an `ALTER TABLE abuse_filter_log DROP COLUMN afl_log_id`
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 INTO abuse_filter_log_tmp
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,47 +0,0 @@
-- Split afl_filter into afl_filter_id and afl_global
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 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_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

@ -58,20 +58,6 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {
);
if ( $dbType === 'mysql' || $dbType === 'sqlite' ) {
// 1.34
$updater->dropExtensionField(
'abuse_filter_log',
'afl_log_id',
"$dir/$dbType/patch-drop_afl_log_id.sql"
);
// 1.34
$updater->addExtensionField(
'abuse_filter_log',
'afl_filter_id',
"$dir/$dbType/patch-split-afl_filter.sql"
);
if ( $dbType === 'mysql' ) {
// 1.37
$updater->renameExtensionIndex(
@ -110,21 +96,6 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook {
"$dir/$dbType/patch-remove-afl_filter.sql"
);
} elseif ( $dbType === 'postgres' ) {
$updater->addExtensionUpdate( [
'dropPgField', 'abuse_filter_log', 'afl_log_id' ] );
$updater->addExtensionUpdate( [
'setDefault', 'abuse_filter_log', 'afl_filter', ''
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_global', 'SMALLINT NOT NULL DEFAULT 0'
] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_filter_id', 'INTEGER NOT NULL DEFAULT 0'
] );
$updater->addExtensionUpdate( [
'addPgIndex', 'abuse_filter_log', 'abuse_filter_log_filter_timestamp_full',
'(afl_global, afl_filter_id, afl_timestamp)'
] );
$updater->addExtensionUpdate( [
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_timestamp'
] );