6 use FS::UID qw(adminsuidsetup dbh driver_name);
8 # Fix bad values in some contract_end fields resulting from a short-lived bug
10 my $dbh = adminsuidsetup(shift) or die "Usage: fix-contract_end username\n";
11 local $FS::UID::AutoCommit = 0;
14 q!UPDATE cust_pkg SET contract_end = NULL WHERE contract_end = -1!,
15 q!UPDATE part_pkg_option SET optionvalue = NULL WHERE optionname = 'contract_end_months' AND optionvalue = '(none)'!,
18 foreach my $sql (@updates) {
20 my $rows = $dbh->do($sql);
21 print "$rows rows.\n";
22 die $dbh->errstr if $dbh->errstr;
24 $dbh->commit or die $dbh->errstr;