diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 88188731bd9..8034e801af7 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -172,6 +172,7 @@ class MysqlUpdater extends DatabaseUpdater { [ 'dropIndex', 'categorylinks', 'cl_collation_ext', 'patch-drop-cl_collation_ext.sql' ], [ 'runMaintenance', PopulateUserIsTemp::class, 'maintenance/populateUserIsTemp.php' ], [ 'dropIndex', 'sites', 'site_type', 'patch-sites-drop_indexes.sql' ], + [ 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-drop-iwl_prefix_from_title.sql' ], ]; } diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 8a1a200f17b..60ed533c544 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -472,6 +472,7 @@ class PostgresUpdater extends DatabaseUpdater { [ 'dropIndex', 'categorylinks', 'cl_collation_ext', 'patch-drop-cl_collation_ext.sql' ], [ 'runMaintenance', PopulateUserIsTemp::class, 'maintenance/populateUserIsTemp.php' ], [ 'dropIndex', 'sites', 'site_type', 'patch-sites-drop_indexes.sql' ], + [ 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-drop-iwl_prefix_from_title.sql' ], ]; } diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 2298772d331..5f19343e29a 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -154,6 +154,7 @@ class SqliteUpdater extends DatabaseUpdater { [ 'dropIndex', 'categorylinks', 'cl_collation_ext', 'patch-drop-cl_collation_ext.sql' ], [ 'runMaintenance', PopulateUserIsTemp::class, 'maintenance/populateUserIsTemp.php' ], [ 'dropIndex', 'sites', 'site_type', 'patch-sites-drop_indexes.sql' ], + [ 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-drop-iwl_prefix_from_title.sql' ], ]; } diff --git a/maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json b/maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json new file mode 100644 index 00000000000..170f77bbae4 --- /dev/null +++ b/maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json @@ -0,0 +1,75 @@ +{ + "comment": "Drop iwl_title field from iwl_prefix_from_title index", + "before": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + }, + { + "name": "iwl_prefix_from_title", + "columns": [ "iwl_prefix", "iwl_from", "iwl_title" ], + "comment": "Index for ApiQueryIWLinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + }, + "after": { + "name": "iwlinks", + "comment": "Track inline interwiki links", + "columns": [ + { + "name": "iwl_from", + "comment": "page_id of the referring page", + "type": "integer", + "options": { "notnull": true, "unsigned": true, "default": 0 } + }, + { + "name": "iwl_prefix", + "type": "binary", + "comment": "Interwiki prefix code of the target", + "options": { "notnull": true, "length": 32, "default": "" } + }, + { + "name": "iwl_title", + "type": "binary", + "comment": "Title of the target, including namespace", + "options": { "notnull": true, "length": 255, "default": "" } + } + ], + "indexes": [ + { + "name": "iwl_prefix_title_from", + "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], + "comment": "Index for ApiQueryIWBacklinks", + "unique": false + } + ], + "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ] + } +} diff --git a/maintenance/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql b/maintenance/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql new file mode 100644 index 00000000000..14d434eab66 --- /dev/null +++ b/maintenance/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql @@ -0,0 +1,5 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX iwl_prefix_from_title ON /*_*/iwlinks; diff --git a/maintenance/postgres/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql b/maintenance/postgres/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql new file mode 100644 index 00000000000..9bb9ad80146 --- /dev/null +++ b/maintenance/postgres/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql @@ -0,0 +1,5 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +DROP INDEX iwl_prefix_from_title; diff --git a/maintenance/postgres/tables-generated.sql b/maintenance/postgres/tables-generated.sql index 339b0868573..e69985e9f89 100644 --- a/maintenance/postgres/tables-generated.sql +++ b/maintenance/postgres/tables-generated.sql @@ -238,8 +238,6 @@ CREATE TABLE iwlinks ( CREATE INDEX iwl_prefix_title_from ON iwlinks (iwl_prefix, iwl_title, iwl_from); -CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title); - CREATE TABLE category ( cat_id SERIAL NOT NULL, diff --git a/maintenance/sqlite/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql b/maintenance/sqlite/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql new file mode 100644 index 00000000000..f37b4ab29f3 --- /dev/null +++ b/maintenance/sqlite/archives/patch-iwlinks-drop-iwl_prefix_from_title.sql @@ -0,0 +1,29 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-iwlinks-drop-iwl_prefix_from_title.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +CREATE TEMPORARY TABLE /*_*/__temp__iwlinks AS +SELECT + iwl_from, + iwl_prefix, + iwl_title +FROM /*_*/iwlinks; +DROP TABLE /*_*/iwlinks; + + +CREATE TABLE /*_*/iwlinks ( + iwl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, + iwl_prefix BLOB DEFAULT '' NOT NULL, + iwl_title BLOB DEFAULT '' NOT NULL, + PRIMARY KEY(iwl_from, iwl_prefix, iwl_title) + ); +INSERT INTO /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title) +SELECT + iwl_from, + iwl_prefix, + iwl_title +FROM + /*_*/__temp__iwlinks; +DROP TABLE /*_*/__temp__iwlinks; + +CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from); diff --git a/maintenance/sqlite/tables-generated.sql b/maintenance/sqlite/tables-generated.sql index b6d5ef0a5a2..aaa0d8ecf82 100644 --- a/maintenance/sqlite/tables-generated.sql +++ b/maintenance/sqlite/tables-generated.sql @@ -231,8 +231,6 @@ CREATE TABLE /*_*/iwlinks ( CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from); -CREATE INDEX iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title); - CREATE TABLE /*_*/category ( cat_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, diff --git a/maintenance/tables-generated.sql b/maintenance/tables-generated.sql index 7027b424fe2..602cd5feff6 100644 --- a/maintenance/tables-generated.sql +++ b/maintenance/tables-generated.sql @@ -212,7 +212,6 @@ CREATE TABLE /*_*/iwlinks ( iwl_prefix VARBINARY(32) DEFAULT '' NOT NULL, iwl_title VARBINARY(255) DEFAULT '' NOT NULL, INDEX iwl_prefix_title_from (iwl_prefix, iwl_title, iwl_from), - INDEX iwl_prefix_from_title (iwl_prefix, iwl_from, iwl_title), PRIMARY KEY(iwl_from, iwl_prefix, iwl_title) ) /*$wgDBTableOptions*/; diff --git a/maintenance/tables.json b/maintenance/tables.json index ada5fbfb78b..b413f0fbcd7 100644 --- a/maintenance/tables.json +++ b/maintenance/tables.json @@ -698,12 +698,6 @@ "columns": [ "iwl_prefix", "iwl_title", "iwl_from" ], "comment": "Index for ApiQueryIWBacklinks", "unique": false - }, - { - "name": "iwl_prefix_from_title", - "columns": [ "iwl_prefix", "iwl_from", "iwl_title" ], - "comment": "Index for ApiQueryIWLinks", - "unique": false } ], "pk": [ "iwl_from", "iwl_prefix", "iwl_title" ]