diff options
author | ivan <ivan> | 2009-02-01 04:13:36 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-02-01 04:13:36 +0000 |
commit | bd3424095611ae3563e770239940b99bf9744fba (patch) | |
tree | 4c733840a1a215c7f733441bf0e510f352331076 /FS | |
parent | 7ebd7ac91d49b174be34057fc53498c5d5b89cb1 (diff) |
commit after each table upgrade, helps with getting huge dbs upgraded, RT#4679
Diffstat (limited to 'FS')
-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 999c044ba..6adc736df 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; - } - } |