X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Ftest_scrub;h=88edc335bd2ed08921a2a2680efcd277e9a3f291;hp=5766925a60265bb6aa48a1756feaf3f88b7bd582;hb=1af3778f939f270e2f7a6474fce7d6fefd06517a;hpb=624b2d44625f69d71175c3348cae635d580c890b diff --git a/bin/test_scrub b/bin/test_scrub index 5766925a6..88edc335b 100644 --- a/bin/test_scrub +++ b/bin/test_scrub @@ -12,8 +12,13 @@ #-business-onlinepayment and business-onlinepayment-ach config use strict; +use vars qw( $opt_h ); +use Getopt::Std; use FS::UID qw(adminsuidsetup dbh); use FS::Conf; +use FS::Schema qw(dbdef); + +getopts('h'); adminsuidsetup shift; @@ -45,4 +50,11 @@ foreach my $item (qw( $conf->delete($item); } +if ($opt_h) { # not all history can be safely deleted + foreach my $table (grep { /^h_\w+$/ } dbdef->tables) { + my $sth = dbh->prepare("DELETE FROM $table") or die dbh->errstr; + $sth->execute or die $sth->errstr; + } +} + dbh->commit or die dbh->errstr;