summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-upgrade
diff options
context:
space:
mode:
authorivan <ivan>2008-12-21 21:39:55 +0000
committerivan <ivan>2008-12-21 21:39:55 +0000
commitb333223b0223e560a877e1d5f4c433b5ef6da54f (patch)
tree9d1bf46631621a962a68a6ac5f8fb384930a27a4 /FS/bin/freeside-upgrade
parent48bade3f01a672f235d61a29ad0d0b792fc80eab (diff)
unique checking for svc_phone like svc_acct, closes: RT#4204 (also a few lines of the new per-agent config snuck in Conf.pm from RT#3989)
Diffstat (limited to 'FS/bin/freeside-upgrade')
-rwxr-xr-xFS/bin/freeside-upgrade23
1 files changed, 14 insertions, 9 deletions
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index f3c446169..0b5758d8e 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -77,21 +77,26 @@ print "\n" if $DRY_RUN;
if ( $dbh->{Driver}->{Name} =~ /^mysql/i && ! $opt_s ) {
- my $sth = $dbh->prepare(
- "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = 'svc_acct'"
- ) or die $dbh->errstr;
+ foreach my $table (qw( svc_acct svc_phone )) {
- $sth->execute or die $sth->errstr;
-
- unless ( $sth->fetchrow_arrayref->[0] ) {
-
- $sth = $dbh->prepare(
- "INSERT INTO duplicate_lock ( lockname ) VALUES ( 'svc_acct' )"
+ my $sth = $dbh->prepare(
+ "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = '$table'"
) or die $dbh->errstr;
$sth->execute or die $sth->errstr;
+ unless ( $sth->fetchrow_arrayref->[0] ) {
+
+ $sth = $dbh->prepare(
+ "INSERT INTO duplicate_lock ( lockname ) VALUES ( '$table' )"
+ ) or die $dbh->errstr;
+
+ $sth->execute or die $sth->errstr;
+
+ }
+
}
+
}
$dbh->commit or die $dbh->errstr;