Skip to content

Commit

Permalink
drop table statement wasn't added to create statement if add_drop_abl…
Browse files Browse the repository at this point in the history
…e attribute was set
  • Loading branch information
djerius committed Sep 23, 2023
1 parent 39e00ab commit 0cbfeb2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/SQL/Translator/Producer/Sybase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,19 @@ sub produce {
join( ', ', $index->fields ) . ")";
}

my $drop_statement = $add_drop_table
? qq[DROP TABLE $table_name_ur] : '';
my $create_statement = qq[CREATE TABLE $table_name_ur (\n].
my @statements;
push @statements, qq[DROP TABLE $table_name_ur\n\n] if $add_drop_table;
push @statements, qq[CREATE TABLE $table_name_ur (\n].
join( ",\n",
map { " $_" } @field_defs, @constraint_defs
).
"\n)"
;

$create_statement = join("\n\n", @comments) . "\n\n" . $create_statement;
# prefix the first statement with the comments
unshift @statements, join("\n\n", @comments) . "\n\n" . shift( @statements );
push @output,
$create_statement,
@statements,
@index_defs,
;
}
Expand Down

0 comments on commit 0cbfeb2

Please sign in to comment.