Index: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +--
|
| 3 | +-- patch-pl-tl-il-unique-index.sql
|
| 4 | +--
|
| 5 | +-- Make reorderings of UNIQUE indices UNIQUE as well
|
| 6 | +
|
| 7 | +DROP INDEX pl_namespace ON /*_*/pagelinks;
|
| 8 | +CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
|
| 9 | +DROP INDEX tl_namespace ON /*_*/templatelinks;
|
| 10 | +CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
|
| 11 | +DROP INDEX il_to ON /*_*/imagelinks;
|
| 12 | +CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
|
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -150,6 +150,7 @@ |
151 | 151 | array( 'do_active_users_init' ), |
152 | 152 | array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ), |
153 | 153 | array( 'add_index', 'user_newtalk', 'un_user_id', 'patch-index-renames.sql' ), |
| 154 | + array( 'do_unique_pl_tl_il' ), |
154 | 155 | ), |
155 | 156 | |
156 | 157 | 'sqlite' => array( |
— | — | @@ -1266,6 +1267,17 @@ |
1267 | 1268 | echo "done\n"; |
1268 | 1269 | } |
1269 | 1270 | |
| 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 | +} |
1270 | 1282 | |
1271 | 1283 | /*********************************************************************** |
1272 | 1284 | * Start PG crap |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -408,7 +408,7 @@ |
409 | 409 | ) /*$wgDBTableOptions*/; |
410 | 410 | |
411 | 411 | CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
412 | | -CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
| 412 | +CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
413 | 413 | |
414 | 414 | |
415 | 415 | -- |
— | — | @@ -427,7 +427,7 @@ |
428 | 428 | ) /*$wgDBTableOptions*/; |
429 | 429 | |
430 | 430 | CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
431 | | -CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
| 431 | +CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
432 | 432 | |
433 | 433 | |
434 | 434 | -- |
— | — | @@ -446,7 +446,7 @@ |
447 | 447 | ) /*$wgDBTableOptions*/; |
448 | 448 | |
449 | 449 | CREATE UNIQUE INDEX il_from ON /*_*/imagelinks (il_from,il_to); |
450 | | -CREATE INDEX il_to ON /*_*/imagelinks (il_to,il_from); |
| 450 | +CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to,il_from); |
451 | 451 | |
452 | 452 | |
453 | 453 | -- |