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|pg)_/ } $schema->tables;
+foreach my $table ( @tables ) {
+ next if grep { /^h_$table/ } $schema->tables;
+ warn "creating history table for $table\n";
+ my $tableobj = $schema->table($table)
+ or die "unknown table $table (did you run dbdef-create?)\n";
my $h_tableobj = DBIx::DBSchema::Table->new( {
name => "h_$table",
primary_key => 'historynum',
$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";
}