skip history tables that exist already; easier to re-run now
[freeside.git] / bin / create-history-tables
index 9ed641e..47d9d6a 100755 (executable)
@@ -20,9 +20,10 @@ my @tables = scalar(@ARGV)
                ? @ARGV
                : grep { ! /^h_/ } $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 talble $table (did you run dbdef-create?)\n";
+    or die "unknown table $table (did you run dbdef-create?)\n";
   my $h_tableobj = DBIx::DBSchema::Table->new( {
     name        => "h_$table",
     primary_key => 'historynum',