[freeside-commits] freeside/bin test_scrub,1.1,1.2
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Aug 18 16:42:28 PDT 2010
Update of /home/cvs/cvsroot/freeside/bin
In directory wavetail.420.am:/tmp/cvs-serv29252
Modified Files:
test_scrub
Log Message:
add -h flag to remove history too
Index: test_scrub
===================================================================
RCS file: /home/cvs/cvsroot/freeside/bin/test_scrub,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- test_scrub 1 Feb 2009 13:52:20 -0000 1.1
+++ test_scrub 18 Aug 2010 23:42:26 -0000 1.2
@@ -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 @@
$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;
More information about the freeside-commits
mailing list