From 5e95676e99684e0e014faffbaa04cd7ca38381b9 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Wed, 20 Oct 2021 15:22:04 +0200 Subject: [PATCH] Rename filter_timestamp index in a different file Otherwise there might be interferences with the remove-afl_filter patch. Bug: T291725 Change-Id: If339663d491e1da4a118c13cd667d228365b4864 --- db_patches/mysql/patch-rename-filter_timestamp-index.sql | 2 ++ db_patches/mysql/patch-rename-indexes.sql | 2 -- includes/Hooks/Handlers/SchemaChangesHandler.php | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 db_patches/mysql/patch-rename-filter_timestamp-index.sql diff --git a/db_patches/mysql/patch-rename-filter_timestamp-index.sql b/db_patches/mysql/patch-rename-filter_timestamp-index.sql new file mode 100644 index 000000000..603e62c12 --- /dev/null +++ b/db_patches/mysql/patch-rename-filter_timestamp-index.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/abuse_filter_log DROP INDEX /*i*/filter_timestamp; +CREATE INDEX /*i*/afl_filter_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_filter,afl_timestamp); diff --git a/db_patches/mysql/patch-rename-indexes.sql b/db_patches/mysql/patch-rename-indexes.sql index fc2bceee0..0f31c7ab1 100644 --- a/db_patches/mysql/patch-rename-indexes.sql +++ b/db_patches/mysql/patch-rename-indexes.sql @@ -5,12 +5,10 @@ ALTER TABLE /*_*/abuse_filter ADD INDEX /*i*/af_group_enabled(af_group,af_enabled,af_id); ALTER TABLE /*_*/abuse_filter_log - DROP INDEX /*i*/filter_timestamp, DROP INDEX /*i*/filter_timestamp_full, DROP INDEX /*i*/user_timestamp, DROP INDEX /*i*/page_timestamp, DROP INDEX /*i*/ip_timestamp; -CREATE INDEX /*i*/afl_filter_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_filter,afl_timestamp); CREATE INDEX /*i*/afl_filter_timestamp_full ON /*$wgDBprefix*/abuse_filter_log (afl_global,afl_filter_id,afl_timestamp); CREATE INDEX /*i*/afl_user_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_user,afl_user_text,afl_timestamp); CREATE INDEX /*i*/afl_page_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_namespace, afl_title, afl_timestamp); diff --git a/includes/Hooks/Handlers/SchemaChangesHandler.php b/includes/Hooks/Handlers/SchemaChangesHandler.php index 84df85c55..e0f7d9661 100644 --- a/includes/Hooks/Handlers/SchemaChangesHandler.php +++ b/includes/Hooks/Handlers/SchemaChangesHandler.php @@ -86,6 +86,14 @@ class SchemaChangesHandler implements LoadExtensionSchemaUpdatesHook { "$dir/mysql/patch-rename-wiki-timestamp-index.sql", true ); + // This one is also separate to avoid interferences with the afl_filter field removal below. + $updater->renameExtensionIndex( + 'abuse_filter_log', + 'filter_timestamp', + 'afl_filter_timestamp', + "$dir/mysql/patch-rename-filter_timestamp-index.sql", + true + ); } $updater->dropExtensionField( 'abuse_filter_log',