Cleanup "text" (nee old) table, dropping old indexes and fields
authorSam Reed <reedy@users.mediawiki.org>
Tue, 10 Jan 2012 15:04:05 +0000 (15:04 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 10 Jan 2012 15:04:05 +0000 (15:04 +0000)
Add oldwatchlist to dropAncientTables

includes/installer/MysqlUpdater.php
maintenance/archives/patch-drop_old_text_fields.sql [new file with mode: 0644]
maintenance/archives/patch-drop_old_text_indexes.sql [new file with mode: 0644]

index e92e31c..d77940e 100644 (file)
@@ -193,6 +193,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        array( 'addField',      'uploadstash',  'us_chunk_inx',         'patch-uploadstash_chunk.sql' ),
                        array( 'addfield', 'job',           'job_timestamp',    'patch-jobs-add-timestamp.sql' ),
                        array( 'dropAncientTables' ),
+                       array( 'cleanupTextTable' ),
                );
        }
 
@@ -864,6 +865,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        'links', // 1.4
                        'linkscc', // 1.4
                        'old', // 1.4
+                       'oldwatchlist', // pre 1.1?
                        'trackback', // 1.19
                        'user_rights', // 1.5
                        'validate', // 1.6
@@ -875,4 +877,30 @@ class MysqlUpdater extends DatabaseUpdater {
                        }
                }
        }
+
+       protected function cleanupTextTable() {
+               $this->output( "Cleaning up text table\n" );
+
+               /*$oldIndexes = array(
+                       'old_namespace',
+                       'old_timestamp',
+                       'name_title_timestamp',
+                       'user_timestamp',
+                       'usertext_timestamp',
+               );*/
+               $this->dropIndex( 'text', 'old_namespace', 'patch-drop_old_text_indexes.sql' );
+
+               /*$oldFields = array(
+                       'old_namespace',
+                       'old_title',
+                       'old_comment',
+                       'old_user',
+                       'old_user_text',
+                       'old_timestamp',
+                       'old_minor_edit',
+                       'inverse_timestamp',
+               );*/
+               $this->dropField( 'text', 'old_namespace', 'patch-drop_old_text_fields.sql' );
+       }
+
 }
diff --git a/maintenance/archives/patch-drop_old_text_fields.sql b/maintenance/archives/patch-drop_old_text_fields.sql
new file mode 100644 (file)
index 0000000..9fe6394
--- /dev/null
@@ -0,0 +1,8 @@
+ALTER TABLE /*_*/text DROP COLUMN old_namespace;
+ALTER TABLE /*_*/text DROP COLUMN old_title;
+ALTER TABLE /*_*/text DROP COLUMN old_comment;
+ALTER TABLE /*_*/text DROP COLUMN old_user;
+ALTER TABLE /*_*/text DROP COLUMN old_user_text;
+ALTER TABLE /*_*/text DROP COLUMN old_timestamp;
+ALTER TABLE /*_*/text DROP COLUMN old_minor_edit;
+ALTER TABLE /*_*/text DROP COLUMN inverse_timestamp;
\ No newline at end of file
diff --git a/maintenance/archives/patch-drop_old_text_indexes.sql b/maintenance/archives/patch-drop_old_text_indexes.sql
new file mode 100644 (file)
index 0000000..a358399
--- /dev/null
@@ -0,0 +1,5 @@
+DROP INDEX old_namespace ON /*_*/text;
+DROP INDEX old_timestamp ON /*_*/text;
+DROP INDEX name_title_timestamp ON /*_*/text;
+DROP INDEX user_timestamp ON /*_*/text;
+DROP INDEX usertext_timestamp ON /*_*/text;
\ No newline at end of file