something to wipe the CVV from very large databases
[freeside.git] / bin / h_cust_main-wipe_paycvv
diff --git a/bin/h_cust_main-wipe_paycvv b/bin/h_cust_main-wipe_paycvv
new file mode 100755 (executable)
index 0000000..d34c15f
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use FS::UID qw(adminsuidsetup dbh);
+use FS::Record; #buh?
+
+my $user = shift or die 'usage';
+adminsuidsetup $user;
+
+while (1) {
+
+  my $sql = ' UPDATE h_cust_main SET paycvv = NULL
+                WHERE historynum IN ( SELECT historynum FROM h_cust_main
+                                        WHERE paycvv IS NOT NULL LIMIT 8192 )';
+#                                        WHERE paycvv IS NOT NULL LIMIT 1 )';
+
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+
+  print '.'; $|=1;
+
+  my $rv = $sth->execute;
+
+  dbh->commit or die dbh->errstr;
+
+  last if $rv == 0;
+
+}
+
+print "\n";
+