summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2007-08-16 16:19:10 +0000
committerjeff <jeff>2007-08-16 16:19:10 +0000
commitd05e1bb9aa7cbdf9f9f016c8248e53f8cc918851 (patch)
tree029d8c53424ef21db30a1b3c56bae3cd11f738a9
parent1293d137b061f097190eda53e4e78214e18832e6 (diff)
agent_custid bugfix (1746)
-rwxr-xr-xFS/bin/freeside-upgrade19
1 files changed, 18 insertions, 1 deletions
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index 1155af02d..9b95ec198 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -39,10 +39,27 @@ $DBIx::DBSchema::DEBUG = $DEBUG;
$DBIx::DBSchema::Table::DEBUG = $DEBUG;
$DBIx::DBSchema::Index::DEBUG = $DEBUG;
+my @bugfix = ();
+
+if (dbdef->table('cust_main')->column('agent_custid')) {
+ push @bugfix,
+ "UPDATE cust_main SET agent_custid = NULL where agent_custid = ''";
+
+ push @bugfix,
+ "UPDATE h_cust_main SET agent_custid = NULL where agent_custid = ''"
+ if (dbdef->table('h_cust_main'));
+}
+
if ( $DRY_RUN ) {
- print join(";\n", dbdef->sql_update_schema( dbdef_dist, $dbh ) ). ";\n";
+ print
+ join(";\n", @bugfix, dbdef->sql_update_schema( dbdef_dist, $dbh ) ). ";\n";
exit;
} else {
+ foreach my $statement ( @bugfix ) {
+ $dbh->do( $statement )
+ or die "Error: ". $dbh->errstr. "\n executing: $statement";
+ }
+
dbdef->update_schema( dbdef_dist, $dbh );
}