3 #This drops anything from the database that could cause live things to happen.
4 #You'd want to do this on a test copy of your live database but NEVER on the
7 #-all exports (all records in part_export, part_export_option export_svc)
8 #-all non-POST invoice destinations (cust_main_invoice)
9 #-all payment gateways and agent payment gw overrides (payment_gateway,
10 # payment_gateway_option, agent_payment_gateway)
11 #-everything in the job queue (queue and queue_arg)
12 #-business-onlinepayment and business-onlinepayment-ach config
15 use vars qw( $opt_h );
17 use FS::UID qw(adminsuidsetup dbh);
19 use FS::Schema qw(dbdef);
25 foreach my $table (qw(
30 payment_gateway_option
36 my $sth = dbh->prepare("DELETE FROM $table") or die dbh->errstr;
37 $sth->execute or die $sth->errstr;
41 my $dsth = dbh->prepare("DELETE FROM cust_main_invoice WHERE dest != 'POST'")
43 $dsth->execute or die $dsth->errstr;
45 my $conf = new FS::Conf;
47 business-onlinepayment
48 business-onlinepayment-ach
53 if ($opt_h) { # not all history can be safely deleted
54 foreach my $table (grep { /^h_\w+$/ } dbdef->tables) {
55 my $sth = dbh->prepare("DELETE FROM $table") or die dbh->errstr;
56 $sth->execute or die $sth->errstr;
60 dbh->commit or die dbh->errstr;