patch-img_media_type.sql assumed that img_type field existed and dropped it.
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Sat, 28 May 2005 21:18:39 +0000 (21:18 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Sat, 28 May 2005 21:18:39 +0000 (21:18 +0000)
This was incorrect and borked updates; now check for the field and
drop it only if it exists. NB this process should probably be
automated as the field-adding process has been.

maintenance/archives/patch-drop_img_type.sql [new file with mode: 0644]
maintenance/archives/patch-img_media_type.sql
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-drop_img_type.sql b/maintenance/archives/patch-drop_img_type.sql
new file mode 100644 (file)
index 0000000..e373761
--- /dev/null
@@ -0,0 +1,3 @@
+-- img_type is no longer used, delete it
+
+ALTER TABLE /*$wgDBprefix*/image DROP COLUMN img_type;
index c9ef854..2356fc6 100644 (file)
@@ -15,6 +15,3 @@ ALTER TABLE /*$wgDBprefix*/image ADD (
   -- see http://www.iana.org/assignments/media-types/
   img_minor_mime varchar(32) NOT NULL default "unknown"
 );
-
--- img_type is no longer used, delete it
-ALTER TABLE /*$wgDBprefix*/image DROP COLUMN img_type;
\ No newline at end of file
index cb249a7..b21de9e 100644 (file)
@@ -549,6 +549,18 @@ function do_pagelinks_namespace( $namespace ) {
        echo "ok\n";
 }
 
+function do_drop_img_type() {
+        global $wgDatabase;
+        
+        if ($wgDatabase->fieldExists('image', 'img_type')) {
+               echo "Dropping unused img_type field in image table... ";
+               dbsource( "maintenance/archives/patch-drop_img_type.sql", $wgDatabase );
+               echo "ok\n";
+       } else {
+               echo "No img_type field in image table; Good.\n";
+        }
+}
+
 function do_all_updates() {
        global $wgNewTables, $wgNewFields, $wgRenamedTables;
        
@@ -589,7 +601,9 @@ function do_all_updates() {
        do_namespace_size(); flush();
        
        do_pagelinks_update(); flush();
-
+       
+       do_drop_img_type(); flush();
+       
        initialiseMessages(); flush();
 }