From: Matthias Mullie Date: Tue, 14 Mar 2017 14:16:48 +0000 (+0100) Subject: Add image.img_user, image.img_timestamp index X-Git-Tag: 1.31.0-rc.0~3674^2~1 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=792555fceed9fc7b0c58c0851cdca5a66fdde276;p=lhc%2Fweb%2Fwiklou.git Add image.img_user, image.img_timestamp index This will allow searching on user id instead of just the name. This is how ContribsPager, LogPager, ... all work already. Bug: T160415 Change-Id: I4db7bd0f917a428f40eb315246f89d49c7ae5b6a --- diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 3131c3cf5c..ff13196b6b 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -299,6 +299,7 @@ class MysqlUpdater extends DatabaseUpdater { [ 'addField', 'externallinks', 'el_index_60', 'patch-externallinks-el_index_60.sql' ], [ 'dropIndex', 'user_groups', 'ug_user_group', 'patch-user_groups-primary-key.sql' ], [ 'addField', 'user_groups', 'ug_expiry', 'patch-user_groups-ug_expiry.sql' ], + [ 'addIndex', 'image', 'img_user_timestamp', 'patch-image-user-index-2.sql' ], ]; } diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index cdbbfd0c51..dcd66ddeee 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -162,6 +162,7 @@ class SqliteUpdater extends DatabaseUpdater { // 1.29 [ 'addField', 'externallinks', 'el_index_60', 'patch-externallinks-el_index_60.sql' ], [ 'addField', 'user_groups', 'ug_expiry', 'patch-user_groups-ug_expiry.sql' ], + [ 'addIndex', 'image', 'img_user_timestamp', 'patch-image-user-index-2.sql' ], ]; } diff --git a/maintenance/archives/patch-image-user-index-2.sql b/maintenance/archives/patch-image-user-index-2.sql new file mode 100644 index 0000000000..8b19d820bd --- /dev/null +++ b/maintenance/archives/patch-image-user-index-2.sql @@ -0,0 +1 @@ +CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); diff --git a/maintenance/archives/patch-image-user-index.sql b/maintenance/archives/patch-image-user-index.sql index a74d7bd5f3..b44930fcce 100644 --- a/maintenance/archives/patch-image-user-index.sql +++ b/maintenance/archives/patch-image-user-index.sql @@ -1,7 +1,7 @@ -- -- image-user-index.sql -- --- Add user/timestamp index to current image versions +-- Add user_text/timestamp index to current image versions -- ALTER TABLE /*$wgDBprefix*/image diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 44922a4084..8f596904ad 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -899,6 +899,8 @@ CREATE TABLE /*_*/image ( img_sha1 varbinary(32) NOT NULL default '' ) /*$wgDBTableOptions*/; +-- Used by Special:Newimages and ApiQueryAllImages +CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp); CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); -- Used by Special:ListFiles for sort-by-size CREATE INDEX /*i*/img_size ON /*_*/image (img_size);