noise reduction
[freeside.git] / FS / FS / Upgrade.pm
index 452c5a3..5abfa69 100644 (file)
@@ -40,10 +40,6 @@ database upgrades.
 sub upgrade {
   my %opt = @_;
 
-  my $oldAutoCommit = $FS::UID::AutoCommit;
-  local $FS::UID::AutoCommit = 0;
-  $FS::UID::AutoCommit = 0;
-
   my $data = upgrade_data(%opt);
 
   foreach my $table ( keys %$data ) {
@@ -54,7 +50,22 @@ sub upgrade {
 
     if ( $class->can('_upgrade_data') ) {
       warn "Upgrading $table...\n";
+
+      my $start = time;
+
+      my $oldAutoCommit = $FS::UID::AutoCommit;
+      local $FS::UID::AutoCommit = 0;
+      $FS::UID::AutoCommit = 0;
+
       $class->_upgrade_data(%opt);
+
+      if ( $oldAutoCommit ) {
+        dbh->commit or die dbh->errstr;
+      }
+      
+      #warn "\e[1K\rUpgrading $table... done in ". (time-$start). " seconds\n";
+      warn "  done in ". (time-$start). " seconds\n";
+
     } else {
       warn "WARNING: asked for upgrade of $table,".
            " but FS::$table has no _upgrade_data method\n";
@@ -72,10 +83,6 @@ sub upgrade {
 
   }
 
-  if ( $oldAutoCommit ) {
-    dbh->commit or die dbh->errstr;
-  }
-
 }
 
 
@@ -119,6 +126,9 @@ sub upgrade_data {
     #fixup access rights
     'access_right' => [],
 
+    #change tax_rate column types
+    'tax_rate' => [],
+
   ;
 
   \%hash;