X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ftest_scrub;h=45a257ab9d16c0bf4fa6ed1736ccb0731e81a4c1;hb=dcfdfa382ec3e357f1cd3c822fd5e658b0746f85;hp=5766925a60265bb6aa48a1756feaf3f88b7bd582;hpb=0bab56e6204a7e443921730ffcd05517c07cce28;p=freeside.git diff --git a/bin/test_scrub b/bin/test_scrub index 5766925a6..45a257ab9 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; @@ -37,12 +42,26 @@ my $dsth = dbh->prepare("DELETE FROM cust_main_invoice WHERE dest != 'POST'") or die dbh->errstr; $dsth->execute or die $dsth->errstr; +my $sth = dbh->prepare("UPDATE part_event SET disabled = 'Y'"); +$sth->execute or die $sth->errstr; + my $conf = new FS::Conf; foreach my $item (qw( business-onlinepayment business-onlinepayment-ach + dump-localdest + dump-scpdest + cust_bill-ftp_spool + smtpmachine )) { $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;