quick tools for profiling phone number insert/delete, RT#24767
[freeside.git] / bin / svc_phone-bulk_insert-profile
diff --git a/bin/svc_phone-bulk_insert-profile b/bin/svc_phone-bulk_insert-profile
new file mode 100755 (executable)
index 0000000..b1ed899
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+
+use strict;
+use DBIx::Profile;
+use FS::UID qw( adminsuidsetup );
+#use FS::Record qw( qsearchs );
+use FS::svc_phone;
+
+my $user = shift or die &usage;
+my $dbh = adminsuidsetup($user);
+
+my $pkgnum = shift or die &usage;
+my $svcpart = shift or die &usage;
+
+#$FS::cust_pkg::DEBUG = 3;
+$FS::cust_svc::ignore_quantity = 1;
+
+#for ( 1..50000 ) {
+for ( 1..5000 ) {
+  my $svc_phone = new FS::svc_phone {
+    'countrycode' => 1,
+    'phonenum'    => '3125550000' + $_,
+    'pkgnum'      => $pkgnum,
+    'svcpart'     => $svcpart,
+  };
+  my $error = $svc_phone->insert;
+  die $error if $error;
+  print '.' unless $_ % 50 # % 1000;
+}
+
+print "\n";
+print $dbh->sprintProfile;
+#$dbh->printProfile;
+
+sub usage {
+  die "Usage:\n svc_phone-bulk_insert-profile user pkgnum svcpart\n";
+}
+
+1;