adding export to read mailbox status information, RT#15987
[freeside.git] / bin / test_scrub_sql
1 #!/usr/bin/perl -w
2
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
5 #live database itself.
6
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
13 #AND
14 #-masks all payment info
15
16 foreach my $table (qw(
17   part_export_option
18   payment_gateway
19   payment_gateway_option
20   agent_payment_gateway
21   queue
22   queue_arg
23   cust_pay_batch
24 )) {
25   print "DELETE FROM $table;\n";
26   print "DELETE FROM h_$table;\n";
27 }
28
29 foreach my $table (qw(
30   part_export
31   export_svc
32 )) {
33   print "DELETE FROM $table;\n";
34 }
35
36 print "DELETE FROM cust_main_invoice WHERE dest != 'POST';\n";
37
38 foreach my $item (qw(
39   business-onlinepayment
40   business-onlinepayment-ach
41 )) {
42   print "DELETE FROM conf WHERE name = '$item';\n";
43   print "DELETE FROM h_conf WHERE name = '$item';\n";
44 }
45
46 my @ptables = map { ($_, "h_$_") } qw(
47   cust_main
48   cust_pay
49   cust_pay_pending
50   cust_pay_void
51   cust_refund
52 );
53 foreach my $table (@ptables) {
54   print "UPDATE $table SET payinfo = paymask WHERE payby IN ( 'CARD','DCRD','CHEK','DCHK' );\n";
55 }
56
57 print "UPDATE cust_main set paycvv = NULL;\n";
58 print "UPDATE h_cust_main set paycvv = NULL;\n";