Followup to r65105 after discussion with Roan
authorSam Reed <reedy@users.mediawiki.org>
Tue, 25 May 2010 20:37:20 +0000 (20:37 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 25 May 2010 20:37:20 +0000 (20:37 +0000)
Make the non-unique index index all fields

Patches updated, patch created to update index. Table.sql also updated

maintenance/archives/patch-iwlinks.sql
maintenance/archives/patch-rename-iwl_prefix.sql [new file with mode: 0644]
maintenance/tables.sql
maintenance/updaters.inc

index 463c7b3..c1c2595 100644 (file)
@@ -13,4 +13,4 @@ CREATE TABLE /*_*/iwlinks (
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title);
-CREATE INDEX /*i*/iwl_prefix ON /*_*/iwlinks (iwl_prefix, iwl_title);
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
diff --git a/maintenance/archives/patch-rename-iwl_prefix.sql b/maintenance/archives/patch-rename-iwl_prefix.sql
new file mode 100644 (file)
index 0000000..df36029
--- /dev/null
@@ -0,0 +1,5 @@
+-- 
+-- Recreates the iwl_prefix for the iwlinks table
+--
+DROP INDEX /*i*/iwl_prefix ON /*_*/iwlinks;
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
\ No newline at end of file
index c9450b5..fe6f265 100644 (file)
@@ -623,7 +623,7 @@ CREATE TABLE /*_*/iwlinks (
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title);
-CREATE INDEX /*i*/iwl_prefix ON /*_*/iwlinks (iwl_prefix, iwl_title);
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
 
 
 --
index 185e0b4..5188e3f 100644 (file)
@@ -205,6 +205,7 @@ $wgUpdates = array(
 
                // 1.17
                array( 'add_table', 'iwlinks',                           'patch-iwlinks.sql' ),
+               array( 'add_index', 'iwlinks', 'iwl_prefix',                     'patch-rename-iwl_prefix.sql' ),
        ),
 );
 
@@ -315,6 +316,21 @@ function add_index( $table, $index, $patch, $fullpath = false ) {
        }
 }
 
+function drop_index_if_exists( $table, $index, $patch, $fullpath = false ) {
+       global $wgDatabase;
+       if ( $wgDatabase->indexExists( $table, $index ) ) {
+               wfOut( "Dropping $index from table $table... " );
+               if ( $fullpath ) {
+                       $wgDatabase->sourceFile( $patch );
+               } else {
+                       $wgDatabase->sourceFile( archive( $patch ) );
+               }
+               wfOut( "ok\n" );
+       } else {
+               wfOut( "...$index doesn't exist.\n" );
+       }
+}
+
 function do_interwiki_update() {
        # Check that interwiki table exists; if it doesn't source it
        global $wgDatabase, $IP;