X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUpgrade.pm;h=7cf4051aaf7150e67fdf5fd000fbc93004738d2b;hb=fdbee9ee821385bfbd9578f940eeb8ca74cb9eff;hp=bf99dce12a11ca062a424476bc22e0f057a552b8;hpb=9bea322a16b0947c7d912141b6ba3df9d7eea0b0;p=freeside.git diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index bf99dce12..7cf4051aa 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,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; - } - } @@ -84,6 +91,12 @@ sub upgrade_data { tie my %hash, 'Tie::IxHash', + #cust_main (remove paycvv from history) + 'cust_main' => [], + + #msgcat + 'msgcat' => [], + #reason type and reasons 'reason_type' => [], 'reason' => [], @@ -116,6 +129,9 @@ sub upgrade_data { #fixup access rights 'access_right' => [], + #change tax_rate column types + 'tax_rate' => [], + ; \%hash; @@ -206,7 +222,8 @@ sub upgrade_sqlradius { } my $svc_acct = qsearchs({ - 'table' => 'svc_acct.*', + 'select' => 'svc_acct.*', + 'table' => 'svc_acct', 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum )'. 'LEFT JOIN export_svc USING ( svcpart )', 'hashref' => { 'username' => $username },