Add updater to remove inverse_timestamp and fix indexes on revision table
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 14 Mar 2005 02:59:23 +0000 (02:59 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 14 Mar 2005 02:59:23 +0000 (02:59 +0000)
maintenance/archives/patch-inverse_timestamp.sql [new file with mode: 0644]
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-inverse_timestamp.sql b/maintenance/archives/patch-inverse_timestamp.sql
new file mode 100644 (file)
index 0000000..0f7d66f
--- /dev/null
@@ -0,0 +1,15 @@
+-- Removes the inverse_timestamp field from early 1.5 alphas.
+-- This field was used in the olden days as a crutch for sorting
+-- limitations in MySQL 3.x, but is being dropped now as an
+-- unnecessary burden. Serious wikis should be running on 4.x.
+--
+-- Updater added 2005-03-13
+
+ALTER TABLE /*$wgDBprefix*/revision
+  DROP COLUMN inverse_timestamp,
+  DROP INDEX page_timestamp,
+  DROP INDEX user_timestamp,
+  DROP INDEX usertext_timestamp,
+  ADD  INDEX page_timestamp (rev_page,rev_timestamp),
+  ADD  INDEX user_timestamp (rev_user,rev_timestamp),
+  ADD  INDEX usertext_timestamp (rev_user_text,rev_timestamp);
index 1e6319e..a8aab81 100644 (file)
@@ -407,6 +407,18 @@ function do_schema_restructuring() {
        }
 }
 
+function do_inverse_timestamp() {
+       global $wgDatabase;
+       $fname="do_schema_restructuring";
+       if( $wgDatabase->fieldExists( 'revision', 'inverse_timestamp' ) ) {
+               echo "Removing revision.inverse_timestamp and fixing indexes... ";
+               dbsource( 'maintenance/archives/patch-inverse_timestamp.sql', $wgDatabase );
+               echo "ok\n";
+       } else {
+               echo "revision timestamp indexes already up to 2005-03-13\n";
+       }
+}
+
 function do_all_updates() {
        global $wgNewTables, $wgNewFields;
        
@@ -437,6 +449,7 @@ function do_all_updates() {
        do_logging_encoding(); flush();
        
        do_schema_restructuring(); flush();
+       do_inverse_timestamp(); flush();
 
        initialiseMessages(); flush();
 }