Rename all sites indexes
Use uniform prefix with the column names Bug: T270033 Change-Id: I771ffc67a1363d8877c57dce1d8b2acdca8fe5bb
This commit is contained in:
parent
e0371c7183
commit
9907b56c9b
10 changed files with 260 additions and 32 deletions
|
|
@ -478,6 +478,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
[ 'modifyField', 'uploadstash', 'us_timestamp', 'patch-uploadstash-us_timestamp.sql' ],
|
||||
[ 'renameIndex', 'user_properties', 'user_properties_property', 'up_property', false,
|
||||
'patch-user_properties-rename-index.sql' ],
|
||||
[ 'renameIndex', 'sites', 'sites_global_key', 'site_global_key', false, 'patch-sites-rename-indexes.sql' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -882,6 +882,14 @@ class PostgresUpdater extends DatabaseUpdater {
|
|||
[ 'renameIndex', 'uploadstash', 'us_key_idx', 'us_key' ],
|
||||
[ 'renameIndex', 'uploadstash', 'us_timestamp_idx', 'us_timestamp' ],
|
||||
[ 'renameIndex', 'user_properties', 'user_properties_property', 'up_property' ],
|
||||
[ 'renameIndex', 'sites', 'sites_global_key', 'site_global_key' ],
|
||||
[ 'renameIndex', 'sites', 'sites_type', 'site_type' ],
|
||||
[ 'renameIndex', 'sites', 'sites_group, ', 'site_group' ],
|
||||
[ 'renameIndex', 'sites', 'sites_source', 'site_source' ],
|
||||
[ 'renameIndex', 'sites', 'sites_language', 'site_language' ],
|
||||
[ 'renameIndex', 'sites', 'sites_protocol', 'site_protocol' ],
|
||||
[ 'renameIndex', 'sites', 'sites_domain', 'site_domain' ],
|
||||
[ 'renameIndex', 'sites', 'sites_forward', 'site_forward' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ class SqliteUpdater extends DatabaseUpdater {
|
|||
[ 'modifyField', 'logging', 'log_title', 'patch-logging-log_title-varbinary.sql' ],
|
||||
[ 'renameIndex', 'user_properties', 'user_properties_property', 'up_property', false,
|
||||
'patch-user_properties-rename-index.sql' ],
|
||||
[ 'renameIndex', 'sites', 'sites_global_key', 'site_global_key', false, 'patch-sites-rename-indexes.sql' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,169 @@
|
|||
{
|
||||
"comment": "Rename all indexes to have 'site_' prefix (T270033)",
|
||||
"before": {
|
||||
"name": "sites",
|
||||
"comment": "Holds all the sites known to the wiki.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "site_id",
|
||||
"type": "integer",
|
||||
"comment": "Numeric id of the site",
|
||||
"options": { "unsigned": true, "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "site_global_key",
|
||||
"type": "binary",
|
||||
"comment": "Global identifier for the site, ie 'enwiktionary'",
|
||||
"options": { "notnull": true, "length": 64 }
|
||||
},
|
||||
{
|
||||
"name": "site_type",
|
||||
"type": "binary",
|
||||
"comment": "Type of the site, ie 'mediawiki'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_group",
|
||||
"type": "binary",
|
||||
"comment": "Group of the site, ie 'wikipedia'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_source",
|
||||
"type": "binary",
|
||||
"comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_language",
|
||||
"type": "binary",
|
||||
"comment": "Language code of the sites primary language.",
|
||||
"options": { "notnull": true, "length": 35 }
|
||||
},
|
||||
{
|
||||
"name": "site_protocol",
|
||||
"type": "binary",
|
||||
"comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_domain",
|
||||
"type": "string",
|
||||
"comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "site_data",
|
||||
"type": "blob",
|
||||
"comment": "Type dependent site data.",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
},
|
||||
{
|
||||
"name": "site_forward",
|
||||
"type": "mwtinyint",
|
||||
"comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.",
|
||||
"options": { "notnull": true, "length": 1 }
|
||||
},
|
||||
{
|
||||
"name": "site_config",
|
||||
"type": "blob",
|
||||
"comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{ "name": "sites_global_key", "columns": [ "site_global_key" ], "unique": true },
|
||||
{ "name": "sites_type", "columns": [ "site_type" ], "unique": false },
|
||||
{ "name": "sites_group", "columns": [ "site_group" ], "unique": false },
|
||||
{ "name": "sites_source", "columns": [ "site_source" ], "unique": false },
|
||||
{ "name": "sites_language", "columns": [ "site_language" ], "unique": false },
|
||||
{ "name": "sites_protocol", "columns": [ "site_protocol" ], "unique": false },
|
||||
{ "name": "sites_domain", "columns": [ "site_domain" ], "unique": false },
|
||||
{ "name": "sites_forward", "columns": [ "site_forward" ], "unique": false }
|
||||
],
|
||||
"pk": [ "site_id" ]
|
||||
},
|
||||
"after": {
|
||||
"name": "sites",
|
||||
"comment": "Holds all the sites known to the wiki.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "site_id",
|
||||
"type": "integer",
|
||||
"comment": "Numeric id of the site",
|
||||
"options": { "unsigned": true, "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "site_global_key",
|
||||
"type": "binary",
|
||||
"comment": "Global identifier for the site, ie 'enwiktionary'",
|
||||
"options": { "notnull": true, "length": 64 }
|
||||
},
|
||||
{
|
||||
"name": "site_type",
|
||||
"type": "binary",
|
||||
"comment": "Type of the site, ie 'mediawiki'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_group",
|
||||
"type": "binary",
|
||||
"comment": "Group of the site, ie 'wikipedia'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_source",
|
||||
"type": "binary",
|
||||
"comment": "Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_language",
|
||||
"type": "binary",
|
||||
"comment": "Language code of the sites primary language.",
|
||||
"options": { "notnull": true, "length": 35 }
|
||||
},
|
||||
{
|
||||
"name": "site_protocol",
|
||||
"type": "binary",
|
||||
"comment": "Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.",
|
||||
"options": { "notnull": true, "length": 32 }
|
||||
},
|
||||
{
|
||||
"name": "site_domain",
|
||||
"type": "string",
|
||||
"comment": "Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "site_data",
|
||||
"type": "blob",
|
||||
"comment": "Type dependent site data.",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
},
|
||||
{
|
||||
"name": "site_forward",
|
||||
"type": "mwtinyint",
|
||||
"comment": "If site.tld/path/key:pageTitle should forward users to the page on the actual site, where \"key\" is the local identifier.",
|
||||
"options": { "notnull": true, "length": 1 }
|
||||
},
|
||||
{
|
||||
"name": "site_config",
|
||||
"type": "blob",
|
||||
"comment": "Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{ "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true },
|
||||
{ "name": "site_type", "columns": [ "site_type" ], "unique": false },
|
||||
{ "name": "site_group", "columns": [ "site_group" ], "unique": false },
|
||||
{ "name": "site_source", "columns": [ "site_source" ], "unique": false },
|
||||
{ "name": "site_language", "columns": [ "site_language" ], "unique": false },
|
||||
{ "name": "site_protocol", "columns": [ "site_protocol" ], "unique": false },
|
||||
{ "name": "site_domain", "columns": [ "site_domain" ], "unique": false },
|
||||
{ "name": "site_forward", "columns": [ "site_forward" ], "unique": false }
|
||||
],
|
||||
"pk": [ "site_id" ]
|
||||
}
|
||||
}
|
||||
20
maintenance/archives/patch-sites-rename-indexes.sql
Normal file
20
maintenance/archives/patch-sites-rename-indexes.sql
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: maintenance/abstractSchemaChanges/patch-sites-rename-indexes.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX sites_global_key ON /*_*/sites;
|
||||
CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
|
||||
DROP INDEX sites_type ON /*_*/sites;
|
||||
CREATE INDEX site_type ON /*_*/sites (site_type);
|
||||
DROP INDEX sites_group ON /*_*/sites;
|
||||
CREATE INDEX site_group ON /*_*/sites (site_group);
|
||||
DROP INDEX sites_source ON /*_*/sites;
|
||||
CREATE INDEX site_source ON /*_*/sites (site_source);
|
||||
DROP INDEX sites_language ON /*_*/sites;
|
||||
CREATE INDEX site_language ON /*_*/sites (site_language);
|
||||
DROP INDEX sites_protocol ON /*_*/sites;
|
||||
CREATE INDEX site_protocol ON /*_*/sites (site_protocol);
|
||||
DROP INDEX sites_domain ON /*_*/sites;
|
||||
CREATE INDEX site_domain ON /*_*/sites (site_domain);
|
||||
DROP INDEX sites_forward ON /*_*/sites;
|
||||
CREATE INDEX site_forward ON /*_*/sites (site_forward);
|
||||
|
|
@ -382,21 +382,21 @@ CREATE TABLE sites (
|
|||
PRIMARY KEY(site_id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX sites_global_key ON sites (site_global_key);
|
||||
CREATE UNIQUE INDEX site_global_key ON sites (site_global_key);
|
||||
|
||||
CREATE INDEX sites_type ON sites (site_type);
|
||||
CREATE INDEX site_type ON sites (site_type);
|
||||
|
||||
CREATE INDEX sites_group ON sites (site_group);
|
||||
CREATE INDEX site_group ON sites (site_group);
|
||||
|
||||
CREATE INDEX sites_source ON sites (site_source);
|
||||
CREATE INDEX site_source ON sites (site_source);
|
||||
|
||||
CREATE INDEX sites_language ON sites (site_language);
|
||||
CREATE INDEX site_language ON sites (site_language);
|
||||
|
||||
CREATE INDEX sites_protocol ON sites (site_protocol);
|
||||
CREATE INDEX site_protocol ON sites (site_protocol);
|
||||
|
||||
CREATE INDEX sites_domain ON sites (site_domain);
|
||||
CREATE INDEX site_domain ON sites (site_domain);
|
||||
|
||||
CREATE INDEX sites_forward ON sites (site_forward);
|
||||
CREATE INDEX site_forward ON sites (site_forward);
|
||||
|
||||
|
||||
CREATE TABLE user_newtalk (
|
||||
|
|
|
|||
29
maintenance/sqlite/archives/patch-sites-rename-indexes.sql
Normal file
29
maintenance/sqlite/archives/patch-sites-rename-indexes.sql
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: maintenance/abstractSchemaChanges/patch-sites-rename-indexes.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX sites_global_key;
|
||||
DROP INDEX sites_type;
|
||||
DROP INDEX sites_group;
|
||||
DROP INDEX sites_source;
|
||||
DROP INDEX sites_language;
|
||||
DROP INDEX sites_protocol;
|
||||
DROP INDEX sites_domain;
|
||||
DROP INDEX sites_forward;
|
||||
CREATE TEMPORARY TABLE /*_*/__temp__sites AS
|
||||
SELECT site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config
|
||||
FROM /*_*/sites;
|
||||
DROP TABLE /*_*/sites;
|
||||
CREATE TABLE /*_*/sites ( site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, site_global_key BLOB NOT NULL, site_type BLOB NOT NULL, site_group BLOB NOT NULL, site_source BLOB NOT NULL, site_language BLOB NOT NULL, site_protocol BLOB NOT NULL, site_domain VARCHAR(255) NOT NULL, site_data BLOB NOT NULL, site_forward SMALLINT NOT NULL, site_config BLOB NOT NULL );
|
||||
INSERT INTO /*_*/sites ( site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config )
|
||||
SELECT site_id, site_global_key, site_type, site_group, site_source, site_language, site_protocol, site_domain, site_data, site_forward, site_config
|
||||
FROM /*_*/__temp__sites;
|
||||
DROP TABLE /*_*/__temp__sites;
|
||||
CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
|
||||
CREATE INDEX site_type ON /*_*/sites (site_type);
|
||||
CREATE INDEX site_group ON /*_*/sites (site_group);
|
||||
CREATE INDEX site_source ON /*_*/sites (site_source);
|
||||
CREATE INDEX site_language ON /*_*/sites (site_language);
|
||||
CREATE INDEX site_protocol ON /*_*/sites (site_protocol);
|
||||
CREATE INDEX site_domain ON /*_*/sites (site_domain);
|
||||
CREATE INDEX site_forward ON /*_*/sites (site_forward);
|
||||
|
|
@ -365,21 +365,21 @@ CREATE TABLE /*_*/sites (
|
|||
site_config BLOB NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX sites_global_key ON /*_*/sites (site_global_key);
|
||||
CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
|
||||
|
||||
CREATE INDEX sites_type ON /*_*/sites (site_type);
|
||||
CREATE INDEX site_type ON /*_*/sites (site_type);
|
||||
|
||||
CREATE INDEX sites_group ON /*_*/sites (site_group);
|
||||
CREATE INDEX site_group ON /*_*/sites (site_group);
|
||||
|
||||
CREATE INDEX sites_source ON /*_*/sites (site_source);
|
||||
CREATE INDEX site_source ON /*_*/sites (site_source);
|
||||
|
||||
CREATE INDEX sites_language ON /*_*/sites (site_language);
|
||||
CREATE INDEX site_language ON /*_*/sites (site_language);
|
||||
|
||||
CREATE INDEX sites_protocol ON /*_*/sites (site_protocol);
|
||||
CREATE INDEX site_protocol ON /*_*/sites (site_protocol);
|
||||
|
||||
CREATE INDEX sites_domain ON /*_*/sites (site_domain);
|
||||
CREATE INDEX site_domain ON /*_*/sites (site_domain);
|
||||
|
||||
CREATE INDEX sites_forward ON /*_*/sites (site_forward);
|
||||
CREATE INDEX site_forward ON /*_*/sites (site_forward);
|
||||
|
||||
|
||||
CREATE TABLE /*_*/user_newtalk (
|
||||
|
|
|
|||
|
|
@ -339,14 +339,14 @@ CREATE TABLE /*_*/sites (
|
|||
site_data BLOB NOT NULL,
|
||||
site_forward TINYINT(1) NOT NULL,
|
||||
site_config BLOB NOT NULL,
|
||||
UNIQUE INDEX sites_global_key (site_global_key),
|
||||
INDEX sites_type (site_type),
|
||||
INDEX sites_group (site_group),
|
||||
INDEX sites_source (site_source),
|
||||
INDEX sites_language (site_language),
|
||||
INDEX sites_protocol (site_protocol),
|
||||
INDEX sites_domain (site_domain),
|
||||
INDEX sites_forward (site_forward),
|
||||
UNIQUE INDEX site_global_key (site_global_key),
|
||||
INDEX site_type (site_type),
|
||||
INDEX site_group (site_group),
|
||||
INDEX site_source (site_source),
|
||||
INDEX site_language (site_language),
|
||||
INDEX site_protocol (site_protocol),
|
||||
INDEX site_domain (site_domain),
|
||||
INDEX site_forward (site_forward),
|
||||
PRIMARY KEY(site_id)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
|
|
|
|||
|
|
@ -1148,14 +1148,14 @@
|
|||
}
|
||||
],
|
||||
"indexes": [
|
||||
{ "name": "sites_global_key", "columns": [ "site_global_key" ], "unique": true },
|
||||
{ "name": "sites_type", "columns": [ "site_type" ], "unique": false },
|
||||
{ "name": "sites_group", "columns": [ "site_group" ], "unique": false },
|
||||
{ "name": "sites_source", "columns": [ "site_source" ], "unique": false },
|
||||
{ "name": "sites_language", "columns": [ "site_language" ], "unique": false },
|
||||
{ "name": "sites_protocol", "columns": [ "site_protocol" ], "unique": false },
|
||||
{ "name": "sites_domain", "columns": [ "site_domain" ], "unique": false },
|
||||
{ "name": "sites_forward", "columns": [ "site_forward" ], "unique": false }
|
||||
{ "name": "site_global_key", "columns": [ "site_global_key" ], "unique": true },
|
||||
{ "name": "site_type", "columns": [ "site_type" ], "unique": false },
|
||||
{ "name": "site_group", "columns": [ "site_group" ], "unique": false },
|
||||
{ "name": "site_source", "columns": [ "site_source" ], "unique": false },
|
||||
{ "name": "site_language", "columns": [ "site_language" ], "unique": false },
|
||||
{ "name": "site_protocol", "columns": [ "site_protocol" ], "unique": false },
|
||||
{ "name": "site_domain", "columns": [ "site_domain" ], "unique": false },
|
||||
{ "name": "site_forward", "columns": [ "site_forward" ], "unique": false }
|
||||
],
|
||||
"pk": [ "site_id" ]
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue