diff options
Diffstat (limited to 'FS/FS/Upgrade.pm')
-rw-r--r-- | FS/FS/Upgrade.pm | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index 452c5a3..f10ff06 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -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,17 @@ sub upgrade { if ( $class->can('_upgrade_data') ) { warn "Upgrading $table...\n"; + + 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; + } + } else { warn "WARNING: asked for upgrade of $table,". " but FS::$table has no _upgrade_data method\n"; @@ -72,10 +78,6 @@ sub upgrade { } - if ( $oldAutoCommit ) { - dbh->commit or die dbh->errstr; - } - } |