Drop afl_log_id

Field unused since its introduction.

Bug: T214592
Change-Id: I1f4f775e9678de5184672251631a490e4eb81764
This commit is contained in:
Daimona Eaytoy 2019-03-28 14:55:37 +01:00 committed by Huji
parent 6100955242
commit 0b925da36e
10 changed files with 55 additions and 29 deletions

View file

@ -49,8 +49,7 @@ CREATE TABLE abuse_filter_log (
afl_wiki TEXT NULL,
afl_deleted SMALLINT NOT NULL DEFAULT 0,
afl_patrolled_by INTEGER NULL,
afl_rev_id INTEGER NULL,
afl_log_id INTEGER NULL
afl_rev_id INTEGER NULL
);
CREATE INDEX abuse_filter_log_filter_timestamp ON abuse_filter_log(afl_filter,afl_timestamp);
@ -59,7 +58,6 @@ CREATE INDEX abuse_filter_log_timestamp ON abuse_filter_log(afl_timestamp
CREATE INDEX abuse_filter_log_page_timestamp ON abuse_filter_log(afl_namespace, afl_title, afl_timestamp);
CREATE INDEX abuse_filter_log_ip_timestamp ON abuse_filter_log(afl_ip, afl_timestamp);
CREATE INDEX abuse_filter_log_rev_id ON abuse_filter_log(afl_rev_id);
CREATE INDEX abuse_filter_log_log_id ON abuse_filter_log(afl_log_id);
CREATE INDEX abuse_filter_log_wiki_timestamp ON abuse_filter_log(afl_wiki, afl_timestamp);
CREATE SEQUENCE abuse_filter_history_afh_id_seq;

View file

@ -47,7 +47,6 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
afl_patrolled_by int unsigned NULL,
afl_rev_id int unsigned,
afl_log_id int unsigned,
PRIMARY KEY (afl_id),
KEY filter_timestamp (afl_filter,afl_timestamp),
@ -56,7 +55,6 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
KEY page_timestamp (afl_namespace, afl_title, afl_timestamp),
KEY ip_timestamp (afl_ip, afl_timestamp),
KEY (afl_rev_id),
KEY (afl_log_id),
KEY wiki_timestamp (afl_wiki, afl_timestamp)
) /*$wgDBTableOptions*/;

View file

@ -44,8 +44,7 @@ CREATE TABLE /*$wgDBprefix*/abuse_filter_log (
afl_wiki varbinary(64) NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
afl_patrolled_by int unsigned NULL,
afl_rev_id int unsigned,
afl_log_id int unsigned
afl_rev_id int unsigned
) /*$wgDBTableOptions*/;
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);
@ -54,7 +53,6 @@ CREATE INDEX afl_page_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_namespac
CREATE INDEX afl_ip_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_ip, afl_timestamp);
CREATE INDEX afl_wiki_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_wiki, afl_timestamp);
CREATE INDEX afl_rev_id ON /*$wgDBprefix*/abuse_filter_log (afl_rev_id);
CREATE INDEX afl_log_id ON /*$wgDBprefix*/abuse_filter_log (afl_log_id);
CREATE TABLE /*$wgDBprefix*/abuse_filter_history (
afh_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

View file

@ -18,17 +18,16 @@ CREATE TABLE /*_*/abuse_filter_log_tmp (
afl_wiki varbinary(64) NULL,
afl_deleted tinyint(1) NOT NULL DEFAULT 0,
afl_patrolled_by int unsigned NULL,
afl_rev_id int unsigned,
afl_log_id int unsigned
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, afl_log_id)
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, afl_log_id
afl_patrolled_by, afl_rev_id
FROM /*_*/abuse_filter_log;
DROP TABLE /*_*/abuse_filter_log;
@ -40,6 +39,5 @@ CREATE INDEX /*i*/afl_page_timestamp ON /*_*/abuse_filter_log (afl_namespace, af
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);
CREATE INDEX /*i*/afl_log_id ON /*_*/abuse_filter_log (afl_log_id);
COMMIT;

View file

@ -1,8 +1,4 @@
-- 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);
ALTER TABLE /*_*/abuse_filter_log
ADD COLUMN afl_log_id int unsigned;
CREATE INDEX /*i*/afl_log_id ON /*_*/abuse_filter_log (afl_log_id);
CREATE INDEX /*i*/afl_rev_id ON /*_*/abuse_filter_log (afl_rev_id);

View file

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

View file

@ -0,0 +1,44 @@
-- 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

@ -585,8 +585,6 @@ class AbuseFilterHooks {
'addPgField', 'abuse_filter_log', 'afl_patrolled_by', 'INTEGER' ] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_rev_id', 'INTEGER' ] );
$updater->addExtensionUpdate( [
'addPgField', 'abuse_filter_log', 'afl_log_id', 'INTEGER' ] );
$updater->addExtensionUpdate( [
'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', '' ] );
$updater->addExtensionUpdate( [
@ -623,14 +621,12 @@ class AbuseFilterHooks {
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_rev_id',
'(afl_rev_id)'
] );
$updater->addExtensionUpdate( [
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_log_id',
'(afl_log_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( [ [ __CLASS__, 'createAbuseFilterUser' ] ] );

View file

@ -185,7 +185,6 @@ class AbuseFilterViewRevert extends AbuseFilterView {
$conds[] = 'afl_timestamp <= ' . $dbr->addQuotes( $dbr->timestamp( $periodEnd ) );
}
// All but afl_filter, afl_ip, afl_deleted, afl_patrolled_by, afl_rev_id and afl_log_id
$selectFields = [
'afl_id',
'afl_user',

View file

@ -507,10 +507,7 @@ class SpecialAbuseLog extends SpecialPage {
}
if ( in_array( $this->mSearchImpact, [ '1', '2' ] ) ) {
$unsuccessfulActionConds = $dbr->makeList( [
'afl_rev_id' => null,
'afl_log_id' => null,
], LIST_AND );
$unsuccessfulActionConds = 'afl_rev_id IS NULL';
if ( $this->mSearchImpact === '1' ) {
$conds[] = "NOT ( $unsuccessfulActionConds )";
} else {