diff options
author | jeff <jeff> | 2010-08-18 23:42:26 +0000 |
---|---|---|
committer | jeff <jeff> | 2010-08-18 23:42:26 +0000 |
commit | 2a282861974954f3ae072363845b8dbffd6decc0 (patch) | |
tree | cae3708ce7783673a5f8f44455b4990b975e66e0 | |
parent | ea26ab34f766e0c0a893644aa157eea8d6ccb28e (diff) |
add -h flag to remove history too
-rw-r--r-- | bin/test_scrub | 12 |
1 files changed, 12 insertions, 0 deletions
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; |