diff options
Diffstat (limited to 'FS')
| -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 );  } | 
