summaryrefslogtreecommitdiff
path: root/FS/FS/Upgrade.pm
diff options
context:
space:
mode:
authorivan <ivan>2009-02-01 04:13:35 +0000
committerivan <ivan>2009-02-01 04:13:35 +0000
commit6785173a772fadc8e4c8086c0d754f69933c099d (patch)
tree74092314db5f2c358212ac6b04dac37032765cb3 /FS/FS/Upgrade.pm
parent1804c24af6b02e25415dbf27fc75b3399ba79fde (diff)
commit after each table upgrade, helps with getting huge dbs upgraded, RT#4679
Diffstat (limited to 'FS/FS/Upgrade.pm')
-rw-r--r--FS/FS/Upgrade.pm18
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;
- }
-
}