diff options
author | jeff <jeff> | 2007-08-21 23:52:08 +0000 |
---|---|---|
committer | jeff <jeff> | 2007-08-21 23:52:08 +0000 |
commit | 2a3f680a86496c651f63574ead22b454d4ce0830 (patch) | |
tree | 3581ca9d09159d18f34460a94205986ec5ccc7ef | |
parent | bc99c91d9aa0ed5e7f32da57d9238051e401d13b (diff) |
agent_custid bugfix (1746) (backport)
-rwxr-xr-x | FS/bin/freeside-upgrade | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index b2943524b..792b8ba13 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -34,10 +34,27 @@ reload_dbdef($dbdef_file); $DBIx::DBSchema::DEBUG = $DEBUG; $DBIx::DBSchema::Table::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 ); } |