finish mysql locking workaround
[freeside.git] / FS / FS / Setup.pm
index 55984d4..6807ef7 100644 (file)
@@ -5,7 +5,7 @@ use vars qw( @ISA @EXPORT_OK );
 use Exporter;
 #use Tie::DxHash;
 use Tie::IxHash;
-use FS::UID qw( dbh );
+use FS::UID qw( dbh driver_name );
 use FS::Record;
 
 use FS::svc_domain;
@@ -45,6 +45,8 @@ sub create_initial_data {
 
   populate_locales();
 
+  populate_duplock();
+
   #initial_data data
   populate_initial_data(%opt);
 
@@ -125,6 +127,18 @@ sub _add_locale {
   die $error if $error;
 }
 
+sub populate_duplock {
+
+  return unless driver_name =~ /^mysql/i;
+
+  my $sth = dbh->prepare(
+    "INSERT INTO duplicate_lock ( lockname ) VALUES ( 'svc_acct' )"
+  ) or die dbh->errstr;
+
+  $sth->execute or die $sth->errstr;
+
+}
+
 sub populate_initial_data {
   my %opt = @_;