Rename name_title index to have page_ prefix
Bug: T270033 Change-Id: Id70d0e0a37dd0d000079820d51cef2791f5ec42e
This commit is contained in:
parent
238d987e27
commit
a8c01d7726
11 changed files with 285 additions and 6 deletions
|
|
@ -253,6 +253,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
[ 'addField', 'objectcache', 'modtoken', 'patch-objectcache-modtoken.sql' ],
|
||||
[ 'dropDefault', 'revision', 'rev_timestamp' ],
|
||||
[ 'addIndex', 'oldimage', 'oi_timestamp', 'patch-oldimage-oi_timestamp.sql' ],
|
||||
[ 'renameIndex', 'page', 'name_title', 'page_name_title', false, 'patch-page-rename-name_title-index.sql' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ class PostgresUpdater extends DatabaseUpdater {
|
|||
[ 'changeField', 'content_models', 'model_id', 'INTEGER', '' ],
|
||||
[ 'renameIndex', 'page', 'page_len_idx', 'page_len' ],
|
||||
[ 'renameIndex', 'page', 'page_random_idx', 'page_random' ],
|
||||
[ 'renameIndex', 'page', 'page_unique_name', 'name_title' ],
|
||||
[ 'renameIndex', 'page', 'page_unique_name', 'page_name_title' ],
|
||||
[ 'addPGIndex', 'page', 'page_redirect_namespace_len', '(page_is_redirect, page_namespace, page_len)' ],
|
||||
[ 'dropFkey', 'categorylinks', 'cl_from' ],
|
||||
[ 'setDefault','categorylinks', 'cl_from', 0 ],
|
||||
|
|
@ -634,6 +634,7 @@ class PostgresUpdater extends DatabaseUpdater {
|
|||
'CREATE INDEX rev_page_id ON revision (rev_page,rev_id)' ],
|
||||
[ 'addTable', 'searchindex', 'patch-searchindex-table.sql' ],
|
||||
[ 'addPgIndex', 'oldimage', 'oi_timestamp', '(oi_timestamp)' ],
|
||||
[ 'renameIndex', 'page', 'name_title', 'page_name_title' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,6 +219,8 @@ class SqliteUpdater extends DatabaseUpdater {
|
|||
[ 'addField', 'objectcache', 'modtoken', 'patch-objectcache-modtoken.sql' ],
|
||||
[ 'modifyField', 'revision', 'rev_timestamp', 'patch-revision-rev_timestamp-drop-default.sql' ],
|
||||
[ 'addIndex', 'oldimage', 'oi_timestamp', 'patch-oldimage-oi_timestamp.sql' ],
|
||||
[ 'renameIndex', 'page', 'name_title', 'page_name_title', false,
|
||||
'patch-page-rename-name_title-index.sql' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,249 @@
|
|||
{
|
||||
"comment": "Rename 'name_title' to have the page_ prefix (T270033)",
|
||||
"before": {
|
||||
"name": "page",
|
||||
"comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "page_id",
|
||||
"comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "page_namespace",
|
||||
"comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_title",
|
||||
"comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "page_restrictions",
|
||||
"comment": "Comma-separated set of permission keys indicating who can move or edit the page.",
|
||||
"type": "blob",
|
||||
"options": { "notnull": false, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "page_is_redirect",
|
||||
"comment": "1 indicates the article is a redirect.",
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
},
|
||||
{
|
||||
"name": "page_is_new",
|
||||
"comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.",
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
},
|
||||
{
|
||||
"name": "page_random",
|
||||
"comment": "Random value between 0 and 1, used for Special:Randompage",
|
||||
"type": "float",
|
||||
"options": {
|
||||
"notnull": true,
|
||||
"unsigned": true,
|
||||
"CustomSchemaOptions": {
|
||||
"doublePrecision": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page_touched",
|
||||
"comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_links_updated",
|
||||
"comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.",
|
||||
"type": "mwtimestamp",
|
||||
"options": {
|
||||
"notnull": false,
|
||||
"default": null,
|
||||
"CustomSchemaOptions": {
|
||||
"allowInfinite": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page_latest",
|
||||
"comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_len",
|
||||
"comment": "Uncompressed length in bytes of the page's current source text.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_content_model",
|
||||
"comment": "content model, see CONTENT_MODEL_XXX constants",
|
||||
"type": "binary",
|
||||
"options": { "length": 32, "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "page_lang",
|
||||
"comment": "Page content language",
|
||||
"type": "binary",
|
||||
"options": { "length": 35, "notnull": false }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "name_title",
|
||||
"columns": [ "page_namespace", "page_title" ],
|
||||
"comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.",
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "page_random",
|
||||
"columns": [ "page_random" ],
|
||||
"comment": "Index for Special:Random",
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "page_len",
|
||||
"columns": [ "page_len" ],
|
||||
"comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.",
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "page_redirect_namespace_len",
|
||||
"columns": [ "page_is_redirect", "page_namespace", "page_len" ],
|
||||
"comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().",
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "page_id" ]
|
||||
},
|
||||
"after": {
|
||||
"name": "page",
|
||||
"comment": "Core of the wiki: each page has an entry here which identifies it by title and contains some essential metadata.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "page_id",
|
||||
"comment": "Unique identifier number. The page_id will be preserved across edits and rename operations, but not deletions and recreations.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "page_namespace",
|
||||
"comment": "A page name is broken into a namespace and a title. The namespace keys are UI-language-independent constants, defined in includes/Defines.php",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_title",
|
||||
"comment": "The rest of the title, as text. Spaces are transformed into underscores in title storage.",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "page_restrictions",
|
||||
"comment": "Comma-separated set of permission keys indicating who can move or edit the page.",
|
||||
"type": "blob",
|
||||
"options": { "notnull": false, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "page_is_redirect",
|
||||
"comment": "1 indicates the article is a redirect.",
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
},
|
||||
{
|
||||
"name": "page_is_new",
|
||||
"comment": "1 indicates this is a new entry, with only one edit. Not all pages with one edit are new pages.",
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
},
|
||||
{
|
||||
"name": "page_random",
|
||||
"comment": "Random value between 0 and 1, used for Special:Randompage",
|
||||
"type": "float",
|
||||
"options": {
|
||||
"notnull": true,
|
||||
"unsigned": true,
|
||||
"CustomSchemaOptions": {
|
||||
"doublePrecision": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page_touched",
|
||||
"comment": "This timestamp is updated whenever the page changes in a way requiring it to be re-rendered, invalidating caches. Aside from editing this includes permission changes, creation or deletion of linked pages, and alteration of contained templates.",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_links_updated",
|
||||
"comment": "This timestamp is updated whenever a page is re-parsed and it has all the link tracking tables updated for it. This is useful for de-duplicating expensive backlink update jobs.",
|
||||
"type": "mwtimestamp",
|
||||
"options": {
|
||||
"notnull": false,
|
||||
"default": null,
|
||||
"CustomSchemaOptions": {
|
||||
"allowInfinite": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page_latest",
|
||||
"comment": "Handy key to revision.rev_id of the current revision. This may be 0 during page creation, but that shouldn't happen outside of a transaction... hopefully.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_len",
|
||||
"comment": "Uncompressed length in bytes of the page's current source text.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "page_content_model",
|
||||
"comment": "content model, see CONTENT_MODEL_XXX constants",
|
||||
"type": "binary",
|
||||
"options": { "length": 32, "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "page_lang",
|
||||
"comment": "Page content language",
|
||||
"type": "binary",
|
||||
"options": { "length": 35, "notnull": false }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "page_name_title",
|
||||
"columns": [ "page_namespace", "page_title" ],
|
||||
"comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.",
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "page_random",
|
||||
"columns": [ "page_random" ],
|
||||
"comment": "Index for Special:Random",
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "page_len",
|
||||
"columns": [ "page_len" ],
|
||||
"comment": "Questionable utility, used by ProofreadPage, possibly DynamicPageList. ApiQueryAllPages unconditionally filters on namespace and so hopefully does not use it.",
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "page_redirect_namespace_len",
|
||||
"columns": [ "page_is_redirect", "page_namespace", "page_len" ],
|
||||
"comment": "The index for Special:Shortpages and Special:Longpages. Also SiteStats::articles() in 'comma' counting mode, MessageCache::loadFromDB().",
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "page_id" ]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: maintenance/abstractSchemaChanges/patch-page-rename-name_title-index.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX name_title ON /*_*/page;
|
||||
CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
|
||||
|
|
@ -893,7 +893,7 @@ CREATE TABLE page (
|
|||
PRIMARY KEY(page_id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX name_title ON page (page_namespace, page_title);
|
||||
CREATE UNIQUE INDEX page_name_title ON page (page_namespace, page_title);
|
||||
|
||||
CREATE INDEX page_random ON page (page_random);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: maintenance/abstractSchemaChanges/patch-page-rename-name_title-index.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX name_title;
|
||||
DROP INDEX page_random;
|
||||
DROP INDEX page_len;
|
||||
DROP INDEX page_redirect_namespace_len;
|
||||
CREATE TEMPORARY TABLE /*_*/__temp__page AS
|
||||
SELECT page_id, page_namespace, page_title, page_restrictions, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
|
||||
FROM /*_*/page;
|
||||
DROP TABLE /*_*/page;
|
||||
CREATE TABLE /*_*/page ( page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL, page_restrictions BLOB DEFAULT NULL, page_is_redirect SMALLINT DEFAULT 0 NOT NULL, page_is_new SMALLINT DEFAULT 0 NOT NULL, page_random DOUBLE PRECISION NOT NULL, page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL, page_latest INTEGER UNSIGNED NOT NULL, page_len INTEGER UNSIGNED NOT NULL, page_content_model BLOB DEFAULT NULL, page_lang BLOB DEFAULT NULL );
|
||||
INSERT INTO /*_*/page ( page_id, page_namespace, page_title, page_restrictions, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang )
|
||||
SELECT page_id, page_namespace, page_title, page_restrictions, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang
|
||||
FROM /*_*/__temp__page;
|
||||
DROP TABLE /*_*/__temp__page;
|
||||
CREATE INDEX page_random ON /*_*/page (page_random);
|
||||
CREATE INDEX page_len ON /*_*/page (page_len);
|
||||
CREATE INDEX page_redirect_namespace_len ON /*_*/page ( page_is_redirect, page_namespace, page_len );
|
||||
CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
|
||||
|
|
@ -832,7 +832,7 @@ CREATE TABLE /*_*/page (
|
|||
page_lang BLOB DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX name_title ON /*_*/page (page_namespace, page_title);
|
||||
CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
|
||||
|
||||
CREATE INDEX page_random ON /*_*/page (page_random);
|
||||
|
||||
|
|
|
|||
|
|
@ -828,7 +828,7 @@ CREATE TABLE /*_*/page (
|
|||
page_len INT UNSIGNED NOT NULL,
|
||||
page_content_model VARBINARY(32) DEFAULT NULL,
|
||||
page_lang VARBINARY(35) DEFAULT NULL,
|
||||
UNIQUE INDEX name_title (page_namespace, page_title),
|
||||
UNIQUE INDEX page_name_title (page_namespace, page_title),
|
||||
INDEX page_random (page_random),
|
||||
INDEX page_len (page_len),
|
||||
INDEX page_redirect_namespace_len (
|
||||
|
|
|
|||
|
|
@ -3428,7 +3428,7 @@
|
|||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "name_title",
|
||||
"name": "page_name_title",
|
||||
"columns": [ "page_namespace", "page_title" ],
|
||||
"comment": "The title index. Care must be taken to always specify a namespace when by title, so that the index is used. Even listing all known namespaces with IN() is better than omitting page_namespace from the WHERE clause.",
|
||||
"unique": true
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class DatabaseIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
'revision_actor_temp',
|
||||
'change_tag',
|
||||
'objectcache',
|
||||
'page'
|
||||
];
|
||||
|
||||
$prefixes = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue