diff --git a/db_patches/patch-abuse_filter_history.sql b/db_patches/patch-abuse_filter_history.sql index 0cd7f07a0..c1d26508a 100644 --- a/db_patches/patch-abuse_filter_history.sql +++ b/db_patches/patch-abuse_filter_history.sql @@ -10,11 +10,9 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_history ( afh_comments BLOB NOT NULL, afh_flags TINYBLOB NOT NULL, afh_public_comments TINYBLOB, - afh_actions BLOB, - - PRIMARY KEY (afh_id), - KEY (afh_filter), - KEY (afh_user), - KEY (afh_user_text), - KEY (afh_timestamp) + 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); diff --git a/db_patches/patch-abuse_filter_history.sqlite.sql b/db_patches/patch-abuse_filter_history.sqlite.sql deleted file mode 100644 index c1d26508a..000000000 --- a/db_patches/patch-abuse_filter_history.sqlite.sql +++ /dev/null @@ -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); diff --git a/db_patches/patch-global_logging_wiki-index.sql b/db_patches/patch-global_logging_wiki-index.sql index 690d034e9..694b6e3d4 100644 --- a/db_patches/patch-global_logging_wiki-index.sql +++ b/db_patches/patch-global_logging_wiki-index.sql @@ -1,3 +1,3 @@ --- Add abuse_filter_log idex for afl_wiki. +-- Add abuse_filter_log index for afl_wiki. -ALTER TABLE /*_*/abuse_filter_log ADD KEY wiki_timestamp (afl_wiki, afl_timestamp); +CREATE INDEX afl_wiki_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_wiki, afl_timestamp); diff --git a/db_patches/patch-global_logging_wiki-index.sqlite.sql b/db_patches/patch-global_logging_wiki-index.sqlite.sql deleted file mode 100644 index 694b6e3d4..000000000 --- a/db_patches/patch-global_logging_wiki-index.sqlite.sql +++ /dev/null @@ -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); diff --git a/includes/AbuseFilterHooks.php b/includes/AbuseFilterHooks.php index 85e27bfae..4464eea80 100644 --- a/includes/AbuseFilterHooks.php +++ b/includes/AbuseFilterHooks.php @@ -453,14 +453,13 @@ class AbuseFilterHooks { if ( $updater->getDB()->getType() === 'mysql' ) { $updater->addExtensionUpdate( [ 'addTable', 'abuse_filter', "$dir/abusefilter.tables.sql", true ] ); - $updater->addExtensionUpdate( [ 'addTable', 'abuse_filter_history', - "$dir/db_patches/patch-abuse_filter_history.sql", true ] ); } else { $updater->addExtensionUpdate( [ 'addTable', 'abuse_filter', "$dir/abusefilter.tables.sqlite.sql", true ] ); - $updater->addExtensionUpdate( [ 'addTable', 'abuse_filter_history', - "$dir/db_patches/patch-abuse_filter_history.sqlite.sql", true ] ); } + $updater->addExtensionTable( 'abuse_filter_history', + "$dir/db_patches/patch-abuse_filter_history.sql" ); + $updater->addExtensionUpdate( [ 'addField', 'abuse_filter_history', 'afh_changed_fields', "$dir/db_patches/patch-afh_changed_fields.sql", true @@ -486,20 +485,17 @@ class AbuseFilterHooks { $updater->addExtensionUpdate( [ 'addField', 'abuse_filter', 'af_group', "$dir/db_patches/patch-af_group.sql", true ] ); + $updater->addExtensionIndex( + 'abuse_filter_log', 'afl_wiki_timestamp', + "$dir/db_patches/patch-global_logging_wiki-index.sql" + ); + if ( $updater->getDB()->getType() === 'mysql' ) { - $updater->addExtensionUpdate( [ - 'addIndex', 'abuse_filter_log', 'wiki_timestamp', - "$dir/db_patches/patch-global_logging_wiki-index.sql", true - ] ); $updater->addExtensionUpdate( [ 'modifyField', 'abuse_filter_log', 'afl_namespace', "$dir/db_patches/patch-afl-namespace_int.sql", true ] ); } else { - $updater->addExtensionUpdate( [ - 'addIndex', 'abuse_filter_log', 'afl_wiki_timestamp', - "$dir/db_patches/patch-global_logging_wiki-index.sqlite.sql", true - ] ); $updater->addExtensionUpdate( [ 'modifyField', 'abuse_filter_log', 'afl_namespace', "$dir/db_patches/patch-afl-namespace_int.sqlite.sql", true