Index: trunk/phase3/maintenance/archives/patch-index-renames.sql |
— | — | @@ -1,11 +0,0 @@ |
2 | | - |
3 | | -DROP INDEX user_id ON /*_*/user_newtalk; |
4 | | -DROP INDEX user_ip ON /*_*/user_newtalk; |
5 | | -DROP INDEX usertext_timestamp ON /*_*/archive; |
6 | | -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id); |
7 | | -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip); |
8 | | -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
\ No newline at end of file |
Index: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql |
— | — | @@ -1,11 +0,0 @@ |
2 | | - |
3 | | -DROP INDEX pl_namespace ON /*_*/pagelinks; |
4 | | -CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from); |
5 | | -DROP INDEX tl_namespace ON /*_*/templatelinks; |
6 | | -CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from); |
7 | | -DROP INDEX il_to ON /*_*/imagelinks; |
8 | | -CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to, il_from); |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -149,8 +149,6 @@ |
150 | 150 | array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ), |
151 | 151 | array( 'do_active_users_init' ), |
152 | 152 | array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ), |
153 | | - array( 'add_index', 'user_newtalk', 'un_user_id', 'patch-index-renames.sql' ), |
154 | | - array( 'do_unique_pl_tl_il' ), |
155 | 153 | ), |
156 | 154 | |
157 | 155 | 'sqlite' => array( |
— | — | @@ -1267,17 +1265,6 @@ |
1268 | 1266 | echo "done\n"; |
1269 | 1267 | } |
1270 | 1268 | |
1271 | | -function do_unique_pl_tl_il() { |
1272 | | - global $wgDatabase; |
1273 | | - $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' ); |
1274 | | - if( !$info->Non_unique ) { |
1275 | | - echo "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n"; |
1276 | | - } else { |
1277 | | - echo "Making pl_namespace, tl_namespace and il_to indices UNIQUE... "; |
1278 | | - dbsource( archive( 'patch-pl-tl-il-unique.sql' ), $wgDatabase ); |
1279 | | - echo "ok\n"; |
1280 | | - } |
1281 | | -} |
1282 | 1269 | |
1283 | 1270 | /*********************************************************************** |
1284 | 1271 | * Start PG crap |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -129,8 +129,8 @@ |
130 | 130 | user_editcount int |
131 | 131 | ) /*$wgDBTableOptions*/; |
132 | 132 | |
133 | | -CREATE UNIQUE INDEX user_name ON /*_*/user (user_name); |
134 | | -CREATE INDEX user_email_token ON /*_*/user (user_email_token); |
| 133 | +CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name); |
| 134 | +CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token); |
135 | 135 | |
136 | 136 | |
137 | 137 | -- |
— | — | @@ -156,8 +156,8 @@ |
157 | 157 | ug_group varbinary(16) NOT NULL default '' |
158 | 158 | ) /*$wgDBTableOptions*/; |
159 | 159 | |
160 | | -CREATE UNIQUE INDEX ug_user_group ON /*_*/user_groups (ug_user,ug_group); |
161 | | -CREATE INDEX ug_group ON /*_*/user_groups (ug_group); |
| 160 | +CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group); |
| 161 | +CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group); |
162 | 162 | |
163 | 163 | |
164 | 164 | -- Stores notifications of user talk page changes, for the display |
— | — | @@ -174,8 +174,8 @@ |
175 | 175 | ) /*$wgDBTableOptions*/; |
176 | 176 | |
177 | 177 | -- Indexes renamed for SQLite in 1.14 |
178 | | -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id); |
179 | | -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip); |
| 178 | +CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id); |
| 179 | +CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip); |
180 | 180 | |
181 | 181 | |
182 | 182 | -- |
— | — | @@ -229,9 +229,9 @@ |
230 | 230 | page_len int unsigned NOT NULL |
231 | 231 | ) /*$wgDBTableOptions*/; |
232 | 232 | |
233 | | -CREATE UNIQUE INDEX name_title ON /*_*/page (page_namespace,page_title); |
234 | | -CREATE INDEX page_random ON /*_*/page (page_random); |
235 | | -CREATE INDEX page_len ON /*_*/page (page_len); |
| 233 | +CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title); |
| 234 | +CREATE INDEX /*i*/page_random ON /*_*/page (page_random); |
| 235 | +CREATE INDEX /*i*/page_len ON /*_*/page (page_len); |
236 | 236 | |
237 | 237 | |
238 | 238 | -- |
— | — | @@ -283,11 +283,11 @@ |
284 | 284 | ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024; |
285 | 285 | -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit |
286 | 286 | |
287 | | -CREATE UNIQUE INDEX rev_page_id ON /*_*/revision (rev_page, rev_id); |
288 | | -CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp); |
289 | | -CREATE INDEX page_timestamp ON /*_*/revision (rev_page,rev_timestamp); |
290 | | -CREATE INDEX user_timestamp ON /*_*/revision (rev_user,rev_timestamp); |
291 | | -CREATE INDEX usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); |
| 287 | +CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id); |
| 288 | +CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp); |
| 289 | +CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp); |
| 290 | +CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp); |
| 291 | +CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp); |
292 | 292 | |
293 | 293 | -- |
294 | 294 | -- Holds text of individual page revisions. |
— | — | @@ -388,8 +388,8 @@ |
389 | 389 | ar_parent_id int unsigned default NULL |
390 | 390 | ) /*$wgDBTableOptions*/; |
391 | 391 | |
392 | | -CREATE INDEX name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
393 | | -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
| 392 | +CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp); |
| 393 | +CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp); |
394 | 394 | |
395 | 395 | |
396 | 396 | -- |
— | — | @@ -407,8 +407,8 @@ |
408 | 408 | pl_title varchar(255) binary NOT NULL default '' |
409 | 409 | ) /*$wgDBTableOptions*/; |
410 | 410 | |
411 | | -CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
412 | | -CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
| 411 | +CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
| 412 | +CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
413 | 413 | |
414 | 414 | |
415 | 415 | -- |
— | — | @@ -426,8 +426,8 @@ |
427 | 427 | tl_title varchar(255) binary NOT NULL default '' |
428 | 428 | ) /*$wgDBTableOptions*/; |
429 | 429 | |
430 | | -CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
431 | | -CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
| 430 | +CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
| 431 | +CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
432 | 432 | |
433 | 433 | |
434 | 434 | -- |
— | — | @@ -445,8 +445,8 @@ |
446 | 446 | il_to varchar(255) binary NOT NULL default '' |
447 | 447 | ) /*$wgDBTableOptions*/; |
448 | 448 | |
449 | | -CREATE UNIQUE INDEX il_from ON /*_*/imagelinks (il_from,il_to); |
450 | | -CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to,il_from); |
| 449 | +CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to); |
| 450 | +CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); |
451 | 451 | |
452 | 452 | |
453 | 453 | -- |
— | — | @@ -477,13 +477,13 @@ |
478 | 478 | cl_timestamp timestamp NOT NULL |
479 | 479 | ) /*$wgDBTableOptions*/; |
480 | 480 | |
481 | | -CREATE UNIQUE INDEX cl_from ON /*_*/categorylinks (cl_from,cl_to); |
| 481 | +CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to); |
482 | 482 | |
483 | 483 | -- We always sort within a given category... |
484 | | -CREATE INDEX cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from); |
| 484 | +CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from); |
485 | 485 | |
486 | 486 | -- Not really used? |
487 | | -CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp); |
| 487 | +CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp); |
488 | 488 | |
489 | 489 | |
490 | 490 | -- |
— | — | @@ -513,10 +513,10 @@ |
514 | 514 | cat_hidden tinyint unsigned NOT NULL default 0 |
515 | 515 | ) /*$wgDBTableOptions*/; |
516 | 516 | |
517 | | -CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title); |
| 517 | +CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category (cat_title); |
518 | 518 | |
519 | 519 | -- For Special:Mostlinkedcategories |
520 | | -CREATE INDEX cat_pages ON /*_*/category (cat_pages); |
| 520 | +CREATE INDEX /*i*/cat_pages ON /*_*/category (cat_pages); |
521 | 521 | |
522 | 522 | |
523 | 523 | -- |
— | — | @@ -543,9 +543,9 @@ |
544 | 544 | el_index blob NOT NULL |
545 | 545 | ) /*$wgDBTableOptions*/; |
546 | 546 | |
547 | | -CREATE INDEX el_from ON /*_*/externallinks (el_from, el_to(40)); |
548 | | -CREATE INDEX el_to ON /*_*/externallinks (el_to(60), el_from); |
549 | | -CREATE INDEX el_index ON /*_*/externallinks (el_index(60)); |
| 547 | +CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40)); |
| 548 | +CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from); |
| 549 | +CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60)); |
550 | 550 | |
551 | 551 | |
552 | 552 | -- |
— | — | @@ -562,8 +562,8 @@ |
563 | 563 | ll_title varchar(255) binary NOT NULL default '' |
564 | 564 | ) /*$wgDBTableOptions*/; |
565 | 565 | |
566 | | -CREATE UNIQUE INDEX ll_from ON /*_*/langlinks (ll_from, ll_lang); |
567 | | -CREATE INDEX ll_lang_title ON /*_*/langlinks (ll_lang, ll_title); |
| 566 | +CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang); |
| 567 | +CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks (ll_lang, ll_title); |
568 | 568 | |
569 | 569 | |
570 | 570 | -- |
— | — | @@ -604,7 +604,7 @@ |
605 | 605 | ) /*$wgDBTableOptions*/; |
606 | 606 | |
607 | 607 | -- Pointless index to assuage developer superstitions |
608 | | -CREATE UNIQUE INDEX ss_row_id ON /*_*/site_stats (ss_row_id); |
| 608 | +CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id); |
609 | 609 | |
610 | 610 | |
611 | 611 | -- |
— | — | @@ -682,12 +682,12 @@ |
683 | 683 | |
684 | 684 | -- Unique index to support "user already blocked" messages |
685 | 685 | -- Any new options which prevent collisions should be included |
686 | | -CREATE UNIQUE INDEX ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); |
| 686 | +CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only); |
687 | 687 | |
688 | | -CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user); |
689 | | -CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); |
690 | | -CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); |
691 | | -CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry); |
| 688 | +CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user); |
| 689 | +CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8)); |
| 690 | +CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp); |
| 691 | +CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry); |
692 | 692 | |
693 | 693 | |
694 | 694 | -- |
— | — | @@ -740,13 +740,13 @@ |
741 | 741 | img_sha1 varbinary(32) NOT NULL default '' |
742 | 742 | ) /*$wgDBTableOptions*/; |
743 | 743 | |
744 | | -CREATE INDEX img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
| 744 | +CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp); |
745 | 745 | -- Used by Special:Imagelist for sort-by-size |
746 | | -CREATE INDEX img_size ON /*_*/image (img_size); |
| 746 | +CREATE INDEX /*i*/img_size ON /*_*/image (img_size); |
747 | 747 | -- Used by Special:Newimages and Special:Imagelist |
748 | | -CREATE INDEX img_timestamp ON /*_*/image (img_timestamp); |
| 748 | +CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp); |
749 | 749 | -- Used in API and duplicate search |
750 | | -CREATE INDEX img_sha1 ON /*_*/image (img_sha1); |
| 750 | +CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1); |
751 | 751 | |
752 | 752 | |
753 | 753 | -- |
— | — | @@ -780,11 +780,11 @@ |
781 | 781 | oi_sha1 varbinary(32) NOT NULL default '' |
782 | 782 | ) /*$wgDBTableOptions*/; |
783 | 783 | |
784 | | -CREATE INDEX oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
785 | | -CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
| 784 | +CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp); |
| 785 | +CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp); |
786 | 786 | -- oi_archive_name truncated to 14 to avoid key length overflow |
787 | | -CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
788 | | -CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1); |
| 787 | +CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14)); |
| 788 | +CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1); |
789 | 789 | |
790 | 790 | |
791 | 791 | -- |
— | — | @@ -836,13 +836,13 @@ |
837 | 837 | ) /*$wgDBTableOptions*/; |
838 | 838 | |
839 | 839 | -- pick out by image name |
840 | | -CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
| 840 | +CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); |
841 | 841 | -- pick out dupe files |
842 | | -CREATE INDEX fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
| 842 | +CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); |
843 | 843 | -- sort by deletion time |
844 | | -CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
| 844 | +CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); |
845 | 845 | -- sort by uploader |
846 | | -CREATE INDEX fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
| 846 | +CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp); |
847 | 847 | |
848 | 848 | |
849 | 849 | -- |
— | — | @@ -918,13 +918,13 @@ |
919 | 919 | rc_params blob NULL |
920 | 920 | ) /*$wgDBTableOptions*/; |
921 | 921 | |
922 | | -CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
923 | | -CREATE INDEX rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
924 | | -CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
925 | | -CREATE INDEX new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
926 | | -CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip); |
927 | | -CREATE INDEX rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
928 | | -CREATE INDEX rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
| 922 | +CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp); |
| 923 | +CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title); |
| 924 | +CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id); |
| 925 | +CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp); |
| 926 | +CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip); |
| 927 | +CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text); |
| 928 | +CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp); |
929 | 929 | |
930 | 930 | |
931 | 931 | CREATE TABLE /*_*/watchlist ( |
— | — | @@ -943,8 +943,8 @@ |
944 | 944 | |
945 | 945 | ) /*$wgDBTableOptions*/; |
946 | 946 | |
947 | | -CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title); |
948 | | -CREATE INDEX namespace_title ON /*_*/watchlist (wl_namespace, wl_title); |
| 947 | +CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist (wl_user, wl_namespace, wl_title); |
| 948 | +CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title); |
949 | 949 | |
950 | 950 | |
951 | 951 | -- |
— | — | @@ -969,7 +969,7 @@ |
970 | 970 | math_mathml text |
971 | 971 | ) /*$wgDBTableOptions*/; |
972 | 972 | |
973 | | -CREATE UNIQUE INDEX math_inputhash ON /*_*/math (math_inputhash); |
| 973 | +CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash); |
974 | 974 | |
975 | 975 | |
976 | 976 | -- |
— | — | @@ -991,9 +991,9 @@ |
992 | 992 | si_text mediumtext NOT NULL |
993 | 993 | ) ENGINE=MyISAM; |
994 | 994 | |
995 | | -CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page); |
996 | | -CREATE FULLTEXT INDEX si_title ON /*_*/searchindex (si_title); |
997 | | -CREATE FULLTEXT INDEX si_text ON /*_*/searchindex (si_text); |
| 995 | +CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page); |
| 996 | +CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title); |
| 997 | +CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text); |
998 | 998 | |
999 | 999 | |
1000 | 1000 | -- |
— | — | @@ -1016,7 +1016,7 @@ |
1017 | 1017 | iw_trans tinyint NOT NULL default 0 |
1018 | 1018 | ) /*$wgDBTableOptions*/; |
1019 | 1019 | |
1020 | | -CREATE UNIQUE INDEX iw_prefix ON /*_*/interwiki (iw_prefix); |
| 1020 | +CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix); |
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | -- |
— | — | @@ -1034,7 +1034,7 @@ |
1035 | 1035 | qc_title varchar(255) binary NOT NULL default '' |
1036 | 1036 | ) /*$wgDBTableOptions*/; |
1037 | 1037 | |
1038 | | -CREATE INDEX qc_type ON /*_*/querycache (qc_type,qc_value); |
| 1038 | +CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value); |
1039 | 1039 | |
1040 | 1040 | |
1041 | 1041 | -- |
— | — | @@ -1045,7 +1045,7 @@ |
1046 | 1046 | value mediumblob, |
1047 | 1047 | exptime datetime |
1048 | 1048 | ) /*$wgDBTableOptions*/; |
1049 | | -CREATE INDEX exptime ON /*_*/objectcache (exptime); |
| 1049 | +CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime); |
1050 | 1050 | |
1051 | 1051 | |
1052 | 1052 | -- |
— | — | @@ -1057,7 +1057,7 @@ |
1058 | 1058 | tc_time int NOT NULL |
1059 | 1059 | ) /*$wgDBTableOptions*/; |
1060 | 1060 | |
1061 | | -CREATE UNIQUE INDEX tc_url_idx ON /*_*/transcache (tc_url); |
| 1061 | +CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url); |
1062 | 1062 | |
1063 | 1063 | |
1064 | 1064 | CREATE TABLE /*_*/logging ( |
— | — | @@ -1091,10 +1091,10 @@ |
1092 | 1092 | log_deleted tinyint unsigned NOT NULL default 0 |
1093 | 1093 | ) /*$wgDBTableOptions*/; |
1094 | 1094 | |
1095 | | -CREATE INDEX type_time ON /*_*/logging (log_type, log_timestamp); |
1096 | | -CREATE INDEX user_time ON /*_*/logging (log_user, log_timestamp); |
1097 | | -CREATE INDEX page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
1098 | | -CREATE INDEX times ON /*_*/logging (log_timestamp); |
| 1095 | +CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp); |
| 1096 | +CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp); |
| 1097 | +CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp); |
| 1098 | +CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp); |
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | CREATE TABLE /*_*/trackbacks ( |
— | — | @@ -1105,7 +1105,7 @@ |
1106 | 1106 | tb_ex text, |
1107 | 1107 | tb_name varchar(255) |
1108 | 1108 | ) /*$wgDBTableOptions*/; |
1109 | | -CREATE INDEX tb_page ON /*_*/trackbacks (tb_page); |
| 1109 | +CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page); |
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | -- Jobs performed by parallel apache threads or a command-line daemon |
— | — | @@ -1126,7 +1126,7 @@ |
1127 | 1127 | job_params blob NOT NULL |
1128 | 1128 | ) /*$wgDBTableOptions*/; |
1129 | 1129 | |
1130 | | -CREATE INDEX job_cmd ON /*_*/job (job_cmd, job_namespace, job_title); |
| 1130 | +CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | -- Details of updates to cached special pages |
— | — | @@ -1139,7 +1139,7 @@ |
1140 | 1140 | qci_timestamp binary(14) NOT NULL default '19700101000000' |
1141 | 1141 | ) /*$wgDBTableOptions*/; |
1142 | 1142 | |
1143 | | -CREATE UNIQUE INDEX qci_type ON /*_*/querycache_info (qci_type); |
| 1143 | +CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type); |
1144 | 1144 | |
1145 | 1145 | |
1146 | 1146 | -- For each redirect, this table contains exactly one row defining its target |
— | — | @@ -1155,7 +1155,7 @@ |
1156 | 1156 | rd_title varchar(255) binary NOT NULL default '' |
1157 | 1157 | ) /*$wgDBTableOptions*/; |
1158 | 1158 | |
1159 | | -CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
| 1159 | +CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from); |
1160 | 1160 | |
1161 | 1161 | |
1162 | 1162 | -- Used for caching expensive grouped queries that need two links (for example double-redirects) |
— | — | @@ -1175,9 +1175,9 @@ |
1176 | 1176 | qcc_titletwo varchar(255) binary NOT NULL default '' |
1177 | 1177 | ) /*$wgDBTableOptions*/; |
1178 | 1178 | |
1179 | | -CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
1180 | | -CREATE INDEX qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
1181 | | -CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
| 1179 | +CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value); |
| 1180 | +CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title); |
| 1181 | +CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo); |
1182 | 1182 | |
1183 | 1183 | |
1184 | 1184 | -- Used for storing page restrictions (i.e. protection levels) |
— | — | @@ -1198,10 +1198,10 @@ |
1199 | 1199 | pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT |
1200 | 1200 | ) /*$wgDBTableOptions*/; |
1201 | 1201 | |
1202 | | -CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); |
1203 | | -CREATE UNIQUE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level); |
1204 | | -CREATE UNIQUE INDEX pr_level ON /*_*/page_restrictions (pr_level); |
1205 | | -CREATE UNIQUE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade); |
| 1202 | +CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); |
| 1203 | +CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level); |
| 1204 | +CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level); |
| 1205 | +CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade); |
1206 | 1206 | |
1207 | 1207 | |
1208 | 1208 | -- Protected titles - nonexistent pages that have been protected |
— | — | @@ -1215,8 +1215,8 @@ |
1216 | 1216 | pt_create_perm varbinary(60) NOT NULL |
1217 | 1217 | ) /*$wgDBTableOptions*/; |
1218 | 1218 | |
1219 | | -CREATE UNIQUE INDEX pt_namespace ON /*_*/protected_titles (pt_namespace,pt_title); |
1220 | | -CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp); |
| 1219 | +CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title); |
| 1220 | +CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp); |
1221 | 1221 | |
1222 | 1222 | |
1223 | 1223 | -- Name/value pairs indexed by page_id |
— | — | @@ -1226,7 +1226,7 @@ |
1227 | 1227 | pp_value blob NOT NULL |
1228 | 1228 | ) /*$wgDBTableOptions*/; |
1229 | 1229 | |
1230 | | -CREATE UNIQUE INDEX pp_page ON /*_*/page_props (pp_page,pp_propname); |
| 1230 | +CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname); |
1231 | 1231 | |
1232 | 1232 | |
1233 | 1233 | -- A table to log updates, one text key row per update. |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | return NULL; |
700 | 700 | } |
701 | 701 | while ( $row = $this->fetchObject( $res ) ) { |
702 | | - if ( $row->indexname == $index ) { |
| 702 | + if ( $row->indexname == $this->indexName( $index ) ) { |
703 | 703 | return $row; |
704 | 704 | } |
705 | 705 | } |
— | — | @@ -708,7 +708,7 @@ |
709 | 709 | function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) { |
710 | 710 | $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". |
711 | 711 | " AND indexdef LIKE 'CREATE UNIQUE%(" . |
712 | | - $this->strencode( $index ) . |
| 712 | + $this->strencode( $this->indexName( $index ) ) . |
713 | 713 | ")'"; |
714 | 714 | $res = $this->query( $sql, $fname ); |
715 | 715 | if ( !$res ) |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1191,6 +1191,7 @@ |
1192 | 1192 | # SHOW INDEX should work for 3.x and up: |
1193 | 1193 | # http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html |
1194 | 1194 | $table = $this->tableName( $table ); |
| 1195 | + $index = $this->indexName( $index ); |
1195 | 1196 | $sql = 'SHOW INDEX FROM '.$table; |
1196 | 1197 | $res = $this->query( $sql, $fname ); |
1197 | 1198 | if ( !$res ) { |
— | — | @@ -1574,6 +1575,18 @@ |
1575 | 1576 | } |
1576 | 1577 | |
1577 | 1578 | /** |
| 1579 | + * Get the name of an index in a given table |
| 1580 | + */ |
| 1581 | + function indexName( $index ) { |
| 1582 | + // Backwards-compatibility hack |
| 1583 | + if ( $index == 'ar_usertext_timestamp' ) { |
| 1584 | + return 'usertext_timestamp'; |
| 1585 | + } else { |
| 1586 | + return $index; |
| 1587 | + } |
| 1588 | + } |
| 1589 | + |
| 1590 | + /** |
1578 | 1591 | * Wrapper for addslashes() |
1579 | 1592 | * @param $s String: to be slashed. |
1580 | 1593 | * @return String: slashed string. |
— | — | @@ -1621,7 +1634,7 @@ |
1622 | 1635 | * PostgreSQL doesn't have them and returns "" |
1623 | 1636 | */ |
1624 | 1637 | function useIndexClause( $index ) { |
1625 | | - return "FORCE INDEX (" . $index . ")"; |
| 1638 | + return "FORCE INDEX (" . $this->indexName( $index ) . ")"; |
1626 | 1639 | } |
1627 | 1640 | |
1628 | 1641 | /** |
— | — | @@ -2261,6 +2274,9 @@ |
2262 | 2275 | $ins = preg_replace_callback( '!/\*(?:\$wgDBprefix|_)\*/([a-zA-Z_0-9]*)!', |
2263 | 2276 | array( $this, 'tableNameCallback' ), $ins ); |
2264 | 2277 | |
| 2278 | + // Index names |
| 2279 | + $ins = preg_replace_callback( '!/\*i\*/([a-zA-Z_0-9]*)!', |
| 2280 | + array( $this, 'indexNameCallback' ), $ins ); |
2265 | 2281 | return $ins; |
2266 | 2282 | } |
2267 | 2283 | |
— | — | @@ -2272,6 +2288,13 @@ |
2273 | 2289 | return $this->tableName( $matches[1] ); |
2274 | 2290 | } |
2275 | 2291 | |
| 2292 | + /** |
| 2293 | + * Index name callback |
| 2294 | + */ |
| 2295 | + protected function indexNameCallback( $matches ) { |
| 2296 | + return $this->indexName( $matches[1] ); |
| 2297 | + } |
| 2298 | + |
2276 | 2299 | /* |
2277 | 2300 | * Build a concatenation list to feed into a SQL query |
2278 | 2301 | */ |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -157,6 +157,13 @@ |
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
| 161 | + * Index names have DB scope |
| 162 | + */ |
| 163 | + function indexName( $index ) { |
| 164 | + return $index; |
| 165 | + } |
| 166 | + |
| 167 | + /** |
161 | 168 | * This must be called after nextSequenceVal |
162 | 169 | */ |
163 | 170 | function insertId() { |
— | — | @@ -194,7 +201,7 @@ |
195 | 202 | * - if errors are explicitly ignored, returns NULL on failure |
196 | 203 | */ |
197 | 204 | function indexInfo($table, $index, $fname = 'Database::indexExists') { |
198 | | - $sql = 'PRAGMA index_info(' . $this->addQuotes( $index ) . ')'; |
| 205 | + $sql = 'PRAGMA index_info(' . $this->addQuotes( $this->indexName( $index ) ) . ')'; |
199 | 206 | $res = $this->query( $sql, $fname ); |
200 | 207 | if ( !$res ) { |
201 | 208 | return null; |
— | — | @@ -213,7 +220,7 @@ |
214 | 221 | $row = $this->selectRow( 'sqlite_master', '*', |
215 | 222 | array( |
216 | 223 | 'type' => 'index', |
217 | | - 'name' => $index, |
| 224 | + 'name' => $this->indexName( $index ), |
218 | 225 | ), $fname ); |
219 | 226 | if ( !$row || !isset( $row->sql ) ) { |
220 | 227 | return null; |
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | } |
153 | 153 | |
154 | 154 | $this->addOption('LIMIT', $limit + 1); |
155 | | - $this->addOption('USE INDEX', array('archive' => ($mode == 'user' ? 'ar_usertext_timestamp' : 'name_title_timestamp'))); |
| 155 | + $this->addOption('USE INDEX', array('archive' => ($mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp'))); |
156 | 156 | if($mode == 'all') |
157 | 157 | { |
158 | 158 | if($params['unique']) |
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | $condition = array(); |
46 | 46 | |
47 | 47 | $condition['ar_user_text'] = $this->target; |
48 | | - $index = 'ar_usertext_timestamp'; |
| 48 | + $index = 'usertext_timestamp'; |
49 | 49 | |
50 | 50 | return array( $index, $condition ); |
51 | 51 | } |