summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorivan <ivan>2005-07-11 14:15:09 +0000
committerivan <ivan>2005-07-11 14:15:09 +0000
commitb07d04cabdee3bf60e1ef9c622e1e71aade7b46a (patch)
tree42e1e588a0085c3983bd2386610a8060c9a42220 /bin
parent59e0ebbe4d3a271fe46cf5c5b664aeda888d7790 (diff)
adding rt-drop-tables
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rate.import28
-rwxr-xr-xbin/rt-drop-tables29
2 files changed, 48 insertions, 9 deletions
diff --git a/bin/rate.import b/bin/rate.import
index 29b5239..fdd756d 100755
--- a/bin/rate.import
+++ b/bin/rate.import
@@ -59,15 +59,25 @@ while ( my $row = $sth->fetchrow_hashref ) {
$prefix = $2;
}
- my @rate_prefix = map {
- #warn $row->{'Country'}. ": $prefixprefix$_\n";
- new FS::rate_prefix {
- 'countrycode' => $row->{'Code'},
- 'npa' => $prefixprefix.$_,
- };
- }
- split(/\s*[;,]\s*/, $prefix);
-
+ my @rate_prefix = ();
+ if ( $prefix =~ /\d/ ) {
+
+ @rate_prefix = map {
+ #warn $row->{'Country'}. ": $prefixprefix$_\n";
+ new FS::rate_prefix {
+ 'countrycode' => $row->{'Code'},
+ 'npa' => $prefixprefix.$_,
+ };
+ }
+ split(/\s*[;,]\s*/, $prefix);
+
+ } else {
+ @rate_prefix = ( new FS::rate_prefix {
+ 'countycode' => $row->{'Code'},
+ 'npa' => '',
+ };
+ );
+ }
my $dest_detail = new FS::rate_detail {
'ratenum' => $ratenum,
diff --git a/bin/rt-drop-tables b/bin/rt-drop-tables
new file mode 100755
index 0000000..b027542
--- /dev/null
+++ b/bin/rt-drop-tables
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+my @tables = qw(
+Attachments
+Queues
+Links
+Principals
+Groups
+ScripConditions
+Transactions
+Scrips
+ACL
+GroupMembers
+CachedGroupMembers
+Users
+Tickets
+ScripActions
+Templates
+TicketCustomFieldValues
+CustomFields
+CustomFieldValues
+sessions
+);
+
+foreach my $table ( @tables ) {
+ print "drop table $table;\n";
+ print "drop sequence ${table}_id_seq;\n";
+}
+