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 /*i*/pl_namespace ON /*_*/pagelinks; |
| 8 | +CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from); |
| 9 | +DROP INDEX /*i*/tl_namespace ON /*_*/templatelinks; |
| 10 | +CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from); |
| 11 | +DROP INDEX /*i*/il_to ON /*_*/imagelinks; |
| 12 | +CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to, il_from); |
Property changes on: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 13 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -149,6 +149,7 @@ |
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( 'do_unique_pl_tl_il' ), |
153 | 154 | ), |
154 | 155 | |
155 | 156 | 'sqlite' => array( |
— | — | @@ -1265,6 +1266,17 @@ |
1266 | 1267 | echo "done\n"; |
1267 | 1268 | } |
1268 | 1269 | |
| 1270 | +function do_unique_pl_tl_il() { |
| 1271 | + global $wgDatabase; |
| 1272 | + $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' ); |
| 1273 | + if( !$info->Non_unique ) { |
| 1274 | + echo "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n"; |
| 1275 | + } else { |
| 1276 | + echo "Making pl_namespace, tl_namespace and il_to indices UNIQUE... "; |
| 1277 | + dbsource( archive( 'patch-pl-tl-il-unique.sql' ), $wgDatabase ); |
| 1278 | + echo "ok\n"; |
| 1279 | + } |
| 1280 | +} |
1269 | 1281 | |
1270 | 1282 | /*********************************************************************** |
1271 | 1283 | * Start PG crap |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -408,7 +408,7 @@ |
409 | 409 | ) /*$wgDBTableOptions*/; |
410 | 410 | |
411 | 411 | CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); |
412 | | -CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); |
| 412 | +CREATE UNIQUE INDEX /*i*/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 /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); |
431 | | -CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); |
| 431 | +CREATE UNIQUE INDEX /*i*/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 /*i*/il_from ON /*_*/imagelinks (il_from,il_to); |
450 | | -CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); |
| 450 | +CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); |
451 | 451 | |
452 | 452 | |
453 | 453 | -- |