Migrate recentchanges table to abstract schema

This table is massive but thankfully we fixed most of its complexities
in previous patches.

For MySQL/Sqlite:
 - Change type of rc_title and rc_source from "varchar binary" to
   "varbinary"
 - Drop default of rc_timestamp
 - Change rc_timestamp from varbinary(14) to binary(14) to standardize
   timestamp datatypes

One index doesn't follow the uniform prefix rule but since it's in a
maintenance script, will fix that in a follow up.

Bug: T230428
Bug: T42626
Change-Id: I13994e02ad3a2293148346ef7be96746578ad854
This commit is contained in:
Amir Sarabadani 2021-02-26 13:52:22 +01:00
parent 859b2f52d3
commit 4a6d4baaed
12 changed files with 510 additions and 140 deletions

View file

@ -253,6 +253,9 @@ class MysqlUpdater extends DatabaseUpdater {
[ 'renameIndex', 'site_identifiers', 'site_ids_key', 'si_key', false,
'patch-site_identifiers-rename-indexes.sql' ],
[ 'modifyField', 'iwlinks', 'iwl_prefix', 'patch-extend-iwlinks-iwl_prefix.sql' ],
[ 'modifyField', 'recentchanges', 'rc_title', 'patch-recentchanges-rc_title-varbinary.sql' ],
[ 'dropDefault', 'recentchanges', 'rc_timestamp' ],
[ 'modifyField', 'recentchanges', 'rc_timestamp', 'patch-recentchanges-rc_timestamp.sql' ],
];
}

View file

@ -222,6 +222,7 @@ class SqliteUpdater extends DatabaseUpdater {
[ 'modifyField', 'image', 'img_name', 'patch-image-img_name-varbinary.sql' ],
[ 'renameIndex', 'site_identifiers', 'site_ids_key', 'si_key', false,
'patch-site_identifiers-rename-indexes.sql' ],
[ 'modifyField', 'recentchanges', 'rc_title', 'patch-recentchanges-rc_title-varbinary.sql' ],
];
}

View file

@ -0,0 +1,2 @@
ALTER TABLE /*_*/recentchanges
MODIFY rc_timestamp BINARY(14) NOT NULL;

View file

@ -0,0 +1,3 @@
ALTER TABLE /*_*/recentchanges
MODIFY rc_title VARBINARY(255) DEFAULT '' NOT NULL,
MODIFY rc_source VARBINARY(16) DEFAULT '' NOT NULL;

View file

@ -791,3 +791,56 @@ CREATE INDEX img_sha1 ON image (img_sha1);
CREATE INDEX img_media_mime ON image (
img_media_type, img_major_mime, img_minor_mime
);
CREATE TABLE recentchanges (
rc_id SERIAL NOT NULL,
rc_timestamp TIMESTAMPTZ NOT NULL,
rc_actor BIGINT NOT NULL,
rc_namespace INT DEFAULT 0 NOT NULL,
rc_title TEXT DEFAULT '' NOT NULL,
rc_comment_id BIGINT NOT NULL,
rc_minor SMALLINT DEFAULT 0 NOT NULL,
rc_bot SMALLINT DEFAULT 0 NOT NULL,
rc_new SMALLINT DEFAULT 0 NOT NULL,
rc_cur_id INT DEFAULT 0 NOT NULL,
rc_this_oldid INT DEFAULT 0 NOT NULL,
rc_last_oldid INT DEFAULT 0 NOT NULL,
rc_type SMALLINT DEFAULT 0 NOT NULL,
rc_source TEXT DEFAULT '' NOT NULL,
rc_patrolled SMALLINT DEFAULT 0 NOT NULL,
rc_ip TEXT DEFAULT '' NOT NULL,
rc_old_len INT DEFAULT NULL,
rc_new_len INT DEFAULT NULL,
rc_deleted SMALLINT DEFAULT 0 NOT NULL,
rc_logid INT DEFAULT 0 NOT NULL,
rc_log_type TEXT DEFAULT NULL,
rc_log_action TEXT DEFAULT NULL,
rc_params TEXT DEFAULT NULL,
PRIMARY KEY(rc_id)
);
CREATE INDEX rc_timestamp ON recentchanges (rc_timestamp);
CREATE INDEX rc_namespace_title_timestamp ON recentchanges (
rc_namespace, rc_title, rc_timestamp
);
CREATE INDEX rc_cur_id ON recentchanges (rc_cur_id);
CREATE INDEX new_name_timestamp ON recentchanges (
rc_new, rc_namespace, rc_timestamp
);
CREATE INDEX rc_ip ON recentchanges (rc_ip);
CREATE INDEX rc_ns_actor ON recentchanges (rc_namespace, rc_actor);
CREATE INDEX rc_actor ON recentchanges (rc_actor, rc_timestamp);
CREATE INDEX rc_name_type_patrolled_timestamp ON recentchanges (
rc_namespace, rc_type, rc_patrolled,
rc_timestamp
);
CREATE INDEX rc_this_oldid ON recentchanges (rc_this_oldid);

View file

@ -116,43 +116,6 @@ CREATE INDEX ar_actor_timestamp ON archive (ar_actor,ar_timestamp
CREATE UNIQUE INDEX ar_revid_uniq ON archive (ar_rev_id);
CREATE SEQUENCE recentchanges_rc_id_seq;
CREATE TABLE recentchanges (
rc_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('recentchanges_rc_id_seq'),
rc_timestamp TIMESTAMPTZ NOT NULL,
rc_actor BIGINT NOT NULL,
rc_namespace INTEGER NOT NULL DEFAULT 0,
rc_title TEXT NOT NULL DEFAULT '',
rc_comment_id BIGINT NOT NULL,
rc_minor SMALLINT NOT NULL DEFAULT 0,
rc_bot SMALLINT NOT NULL DEFAULT 0,
rc_new SMALLINT NOT NULL DEFAULT 0,
rc_cur_id INTEGER NOT NULL DEFAULT 0,
rc_this_oldid INTEGER NOT NULL DEFAULT 0,
rc_last_oldid INTEGER NOT NULL DEFAULT 0,
rc_type SMALLINT NOT NULL DEFAULT 0,
rc_source TEXT NOT NULL DEFAULT '',
rc_patrolled SMALLINT NOT NULL DEFAULT 0,
rc_ip TEXT NOT NULL DEFAULT '',
rc_old_len INTEGER,
rc_new_len INTEGER,
rc_deleted SMALLINT NOT NULL DEFAULT 0,
rc_logid INTEGER NOT NULL DEFAULT 0,
rc_log_type TEXT,
rc_log_action TEXT,
rc_params TEXT
);
ALTER SEQUENCE recentchanges_rc_id_seq OWNED BY recentchanges.rc_id;
CREATE INDEX rc_timestamp ON recentchanges (rc_timestamp);
CREATE INDEX rc_namespace_title_timestamp ON recentchanges (rc_namespace, rc_title, rc_timestamp);
CREATE INDEX rc_cur_id ON recentchanges (rc_cur_id);
CREATE INDEX new_name_timestamp ON recentchanges (rc_new, rc_namespace, rc_timestamp);
CREATE INDEX rc_ip ON recentchanges (rc_ip);
CREATE INDEX rc_ns_actor ON recentchanges (rc_namespace, rc_actor);
CREATE INDEX rc_actor ON recentchanges (rc_actor, rc_timestamp);
CREATE INDEX rc_name_type_patrolled_timestamp ON recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
CREATE INDEX rc_this_oldid ON recentchanges (rc_this_oldid);
-- Tsearch2 2 stuff. Will fail if we don't have proper access to the tsearch2 tables
-- Make sure you also change patch-tsearch2funcs.sql if the funcs below change.
ALTER TABLE page ADD titlevector tsvector;

View file

@ -0,0 +1,48 @@
CREATE TABLE recentchanges_tmp (
rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
rc_namespace INTEGER DEFAULT 0 NOT NULL,
rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_source BLOB DEFAULT '' NOT NULL,
rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
rc_params BLOB DEFAULT NULL
);
INSERT INTO /*_*/recentchanges_tmp (
rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id,
rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted,
rc_logid, rc_log_type, rc_log_action, rc_params)
SELECT rc_id, rc_timestamp, rc_actor, rc_namespace, rc_title, rc_comment_id, rc_minor, rc_bot, rc_new, rc_cur_id,
rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted,
rc_logid, rc_log_type, rc_log_action, rc_params
FROM /*_*/recentchanges;
DROP TABLE /*_*/recentchanges;
ALTER TABLE /*_*/recentchanges_tmp RENAME TO /*_*/recentchanges;
CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
rc_namespace, rc_title, rc_timestamp
);
CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
CREATE INDEX new_name_timestamp ON /*_*/recentchanges (
rc_new, rc_namespace, rc_timestamp
);
CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
rc_namespace, rc_type, rc_patrolled,
rc_timestamp
);
CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);

View file

@ -742,3 +742,50 @@ CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
CREATE INDEX img_media_mime ON /*_*/image (
img_media_type, img_major_mime, img_minor_mime
);
CREATE TABLE /*_*/recentchanges (
rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
rc_namespace INTEGER DEFAULT 0 NOT NULL,
rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_source BLOB DEFAULT '' NOT NULL,
rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
rc_params BLOB DEFAULT NULL
);
CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
rc_namespace, rc_title, rc_timestamp
);
CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
CREATE INDEX new_name_timestamp ON /*_*/recentchanges (
rc_new, rc_namespace, rc_timestamp
);
CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
rc_namespace, rc_type, rc_patrolled,
rc_timestamp
);
CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);

View file

@ -742,3 +742,47 @@ CREATE TABLE /*_*/image (
),
PRIMARY KEY(img_name)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/recentchanges (
rc_id INT AUTO_INCREMENT NOT NULL,
rc_timestamp BINARY(14) NOT NULL,
rc_actor BIGINT UNSIGNED NOT NULL,
rc_namespace INT DEFAULT 0 NOT NULL,
rc_title VARBINARY(255) DEFAULT '' NOT NULL,
rc_comment_id BIGINT UNSIGNED NOT NULL,
rc_minor TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_bot TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_new TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_cur_id INT UNSIGNED DEFAULT 0 NOT NULL,
rc_this_oldid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_last_oldid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_type TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_source VARBINARY(16) DEFAULT '' NOT NULL,
rc_patrolled TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_ip VARBINARY(40) DEFAULT '' NOT NULL,
rc_old_len INT DEFAULT NULL,
rc_new_len INT DEFAULT NULL,
rc_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_logid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_log_type VARBINARY(255) DEFAULT NULL,
rc_log_action VARBINARY(255) DEFAULT NULL,
rc_params BLOB DEFAULT NULL,
INDEX rc_timestamp (rc_timestamp),
INDEX rc_namespace_title_timestamp (
rc_namespace, rc_title, rc_timestamp
),
INDEX rc_cur_id (rc_cur_id),
INDEX new_name_timestamp (
rc_new, rc_namespace, rc_timestamp
),
INDEX rc_ip (rc_ip),
INDEX rc_ns_actor (rc_namespace, rc_actor),
INDEX rc_actor (rc_actor, rc_timestamp),
INDEX rc_name_type_patrolled_timestamp (
rc_namespace, rc_type, rc_patrolled,
rc_timestamp
),
INDEX rc_this_oldid (rc_this_oldid),
PRIMARY KEY(rc_id)
) /*$wgDBTableOptions*/;

View file

@ -2843,5 +2843,313 @@
"pk": [
"img_name"
]
},
{
"name": "recentchanges",
"comment": "Primarily a summary table for Special:Recentchanges, this table contains some additional info on edits from the last few days, see Article::editUpdates()",
"columns": [
{
"name": "rc_id",
"type": "integer",
"options": {
"autoincrement": true,
"notnull": true
}
},
{
"name": "rc_timestamp",
"type": "mwtimestamp",
"options": {
"notnull": true,
"length": 14
}
},
{
"name": "rc_actor",
"comment": "As in revision",
"type": "bigint",
"options": {
"unsigned": true,
"notnull": true
}
},
{
"name": "rc_namespace",
"comment": "When pages are renamed, their RC entries do _not_ change.",
"type": "integer",
"options": {
"notnull": true,
"default": 0
}
},
{
"name": "rc_title",
"type": "binary",
"options": {
"notnull": true,
"default": "",
"length": 255
}
},
{
"name": "rc_comment_id",
"comment": "as in revision...",
"type": "bigint",
"options": {
"unsigned": true,
"notnull": true
}
},
{
"name": "rc_minor",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_bot",
"comment": "Edits by user accounts with the 'bot' rights key are marked with a 1 here, and will be hidden from the default view.",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_new",
"comment": "Set if this change corresponds to a page creation",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_cur_id",
"comment": "Key to page_id (was cur_id prior to 1.5). This will keep links working after moves while retaining the at-the-time name in the changes list.",
"type": "integer",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_this_oldid",
"comment": "rev_id of the given revision",
"type": "integer",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_last_oldid",
"comment": "rev_id of the prior revision, for generating diff links.",
"type": "integer",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_type",
"comment": "The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_source",
"comment": "The source of the change entry (replaces rc_type) default of '' is temporary, needed for initial migration",
"type": "binary",
"options": {
"notnull": true,
"default": "",
"length": 16
}
},
{
"name": "rc_patrolled",
"comment": "If the Recent Changes Patrol option is enabled, users may mark edits as having been reviewed to remove a warning flag on the RC list. A value of 1 indicates the page has been reviewed.",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_ip",
"comment": "Recorded IP address the edit was made from, if the $wgPutIPinRC option is enabled.",
"type": "binary",
"options": {
"notnull": true,
"default": "",
"length": 40
}
},
{
"name": "rc_old_len",
"comment": "Text length in characters before the edit",
"type": "integer",
"options": {
"notnull": false
}
},
{
"name": "rc_new_len",
"comment": "Text length in characters after the edit",
"type": "integer",
"options": {
"notnull": false
}
},
{
"name": "rc_deleted",
"comment": "Visibility of recent changes items, bitfield",
"type": "mwtinyint",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_logid",
"comment": "Value corresponding to log_id, specific log entries",
"type": "integer",
"options": {
"unsigned": true,
"notnull": true,
"default": 0
}
},
{
"name": "rc_log_type",
"comment": "Store log type info here, or null",
"type": "binary",
"options": {
"notnull": false,
"default": null,
"length": 255
}
},
{
"name": "rc_log_action",
"comment": "Store log action or null",
"type": "binary",
"options": {
"notnull": false,
"default": null,
"length": 255
}
},
{
"name": "rc_params",
"comment": "Log params",
"type": "blob",
"options": {
"notnull": false,
"length": 65535
}
}
],
"indexes": [
{
"name": "rc_timestamp",
"comment": "Special:Recentchanges",
"columns": [
"rc_timestamp"
],
"unique": false
},
{
"name": "rc_namespace_title_timestamp",
"comment": "Special:Watchlist",
"columns": [
"rc_namespace",
"rc_title",
"rc_timestamp"
],
"unique": false
},
{
"name": "rc_cur_id",
"comment": "Special:Recentchangeslinked when finding changes in pages linked from a page",
"columns": [
"rc_cur_id"
],
"unique": false
},
{
"name": "new_name_timestamp",
"comment": "Special:Newpages",
"columns": [
"rc_new",
"rc_namespace",
"rc_timestamp"
],
"unique": false
},
{
"name": "rc_ip",
"comment": "Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions, but mostly replaced by CheckUser.",
"columns": [
"rc_ip"
],
"unique": false
},
{
"name": "rc_ns_actor",
"comment": "Probably intended for Special:NewPages namespace filter",
"columns": [
"rc_namespace",
"rc_actor"
],
"unique": false
},
{
"name": "rc_actor",
"comment": "SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter",
"columns": [
"rc_actor",
"rc_timestamp"
],
"unique": false
},
{
"name": "rc_name_type_patrolled_timestamp",
"comment": "ApiQueryRecentChanges (T140108)",
"columns": [
"rc_namespace",
"rc_type",
"rc_patrolled",
"rc_timestamp"
],
"unique": false
},
{
"name": "rc_this_oldid",
"comment": "Article.php and friends (T139012)",
"columns": [
"rc_this_oldid"
],
"unique": false
}
],
"pk": [
"rc_id"
]
}
]

View file

@ -337,109 +337,6 @@ CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp);
CREATE UNIQUE INDEX /*i*/ar_revid_uniq ON /*_*/archive (ar_rev_id);
--
-- Primarily a summary table for Special:Recentchanges,
-- this table contains some additional info on edits from
-- the last few days, see Article::editUpdates()
--
CREATE TABLE /*_*/recentchanges (
rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
rc_timestamp varbinary(14) NOT NULL default '',
-- As in revision
rc_actor bigint unsigned NOT NULL,
-- When pages are renamed, their RC entries do _not_ change.
rc_namespace int NOT NULL default 0,
rc_title varchar(255) binary NOT NULL default '',
-- as in revision...
rc_comment_id bigint unsigned NOT NULL,
rc_minor tinyint unsigned NOT NULL default 0,
-- Edits by user accounts with the 'bot' rights key are
-- marked with a 1 here, and will be hidden from the
-- default view.
rc_bot tinyint unsigned NOT NULL default 0,
-- Set if this change corresponds to a page creation
rc_new tinyint unsigned NOT NULL default 0,
-- Key to page_id (was cur_id prior to 1.5).
-- This will keep links working after moves while
-- retaining the at-the-time name in the changes list.
rc_cur_id int unsigned NOT NULL default 0,
-- rev_id of the given revision
rc_this_oldid int unsigned NOT NULL default 0,
-- rev_id of the prior revision, for generating diff links.
rc_last_oldid int unsigned NOT NULL default 0,
-- The type of change entry (RC_EDIT,RC_NEW,RC_LOG,RC_EXTERNAL)
rc_type tinyint unsigned NOT NULL default 0,
-- The source of the change entry (replaces rc_type)
-- default of '' is temporary, needed for initial migration
rc_source varchar(16) binary not null default '',
-- If the Recent Changes Patrol option is enabled,
-- users may mark edits as having been reviewed to
-- remove a warning flag on the RC list.
-- A value of 1 indicates the page has been reviewed.
rc_patrolled tinyint unsigned NOT NULL default 0,
-- Recorded IP address the edit was made from, if the
-- $wgPutIPinRC option is enabled.
rc_ip varbinary(40) NOT NULL default '',
-- Text length in characters before
-- and after the edit
rc_old_len int,
rc_new_len int,
-- Visibility of recent changes items, bitfield
rc_deleted tinyint unsigned NOT NULL default 0,
-- Value corresponding to log_id, specific log entries
rc_logid int unsigned NOT NULL default 0,
-- Store log type info here, or null
rc_log_type varbinary(255) NULL default NULL,
-- Store log action or null
rc_log_action varbinary(255) NULL default NULL,
-- Log params
rc_params blob NULL
) /*$wgDBTableOptions*/;
-- Special:Recentchanges
CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
-- Special:Watchlist
CREATE INDEX /*i*/rc_namespace_title_timestamp ON /*_*/recentchanges (rc_namespace, rc_title, rc_timestamp);
-- Special:Recentchangeslinked when finding changes in pages linked from a page
CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
-- Special:Newpages
CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
-- Blank unless $wgPutIPinRC=true (false at WMF), possibly used by extensions,
-- but mostly replaced by CheckUser.
CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
-- Probably intended for Special:NewPages namespace filter
CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
-- SiteStats active user count, Special:ActiveUsers, Special:NewPages user filter
CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
-- ApiQueryRecentChanges (T140108)
CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
-- Article.php and friends (T139012)
CREATE INDEX /*i*/rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
--
-- When using the default MySQL search backend, page titles
-- and text are munged to strip markup, do Unicode case folding,

View file

@ -33,6 +33,7 @@ class DatabaseIntegrationTest extends MediaWikiIntegrationTestCase {
'revision_actor_temp',
'change_tag',
'objectcache',
'recentchanges'
];
$prefixes = [];