RADIUS groups on the way!
[freeside.git] / bin / create-history-tables
index fb4c866..9ed641e 100755 (executable)
@@ -16,8 +16,13 @@ my $dbh = adminsuidsetup $user;
 my $schema = dbdef();
 
 #false laziness w/fs-setup
-foreach my $table ( grep { ! /^h_/ } $schema->tables ) {
-  my $tableobj = $schema->table($table);
+my @tables = scalar(@ARGV)
+               ? @ARGV
+               : grep { ! /^h_/ } $schema->tables;
+foreach my $table ( @tables ) {
+  warn "creating history table for $table\n";
+  my $tableobj = $schema->table($table)
+    or die "unknown talble $table (did you run dbdef-create?)\n";
   my $h_tableobj = DBIx::DBSchema::Table->new( {
     name        => "h_$table",
     primary_key => 'historynum',
@@ -73,6 +78,6 @@ $dbh->commit or die $dbh->errstr;
 $dbh->disconnect or die $dbh->errstr;
 
 sub usage {
-  die "Usage:\n  create-history-tables user\n";
+  die "Usage:\n  create-history-tables user [ table table ... ] \n";
 }