Fix incorrect index name in new 1.28.0 installations
authorTim Starling <tstarling@wikimedia.org>
Mon, 3 Apr 2017 03:00:30 +0000 (13:00 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 5 Apr 2017 22:04:06 +0000 (08:04 +1000)
This index name should be the same in new installations as in all other
MySQL installations. This is necessary so that
Special:DeletedContributions does not give an SQL error. Release notes
will go in the 1.28 branch.

Bug: T154872
Change-Id: I535a5513ab56203139c4cf64874ea7e7498990e3

includes/installer/MysqlUpdater.php
maintenance/archives/patch-rename-ar_usertext_timestamp.sql [new file with mode: 0644]

index ff13196..70e790c 100644 (file)
@@ -294,6 +294,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        [ 'addField', 'change_tag', 'ct_id', 'patch-change_tag-ct_id.sql' ],
                        [ 'addField', 'tag_summary', 'ts_id', 'patch-tag_summary-ts_id.sql' ],
                        [ 'modifyField', 'recentchanges', 'rc_ip', 'patch-rc_ip_modify.sql' ],
+                       [ 'addIndex', 'archive', 'usertext_timestamp', 'patch-rename-ar_usertext_timestamp.sql' ],
 
                        // 1.29
                        [ 'addField', 'externallinks', 'el_index_60', 'patch-externallinks-el_index_60.sql' ],
diff --git a/maintenance/archives/patch-rename-ar_usertext_timestamp.sql b/maintenance/archives/patch-rename-ar_usertext_timestamp.sql
new file mode 100644 (file)
index 0000000..658c179
--- /dev/null
@@ -0,0 +1,7 @@
+-- Rename the archive.ar_usertext_timestamp index to usertext_timestamp.
+-- This is for MySQL only and is only necessary on wikis freshly installed on
+-- 1.28.0 when bug T154872 was present. The patch will probably be removed in
+-- 1.29 since we plan on renaming the index properly to ar_usertext_timestamp.
+ALTER TABLE /*$wgDBprefix*/archive
+       DROP INDEX ar_usertext_timestamp,
+       ADD INDEX usertext_timestamp (ar_user_text,ar_timestamp);