From: Arthur Axel 'fREW' Schmidt Date: Fri, 11 Mar 2011 02:53:29 +0000 (-0600) Subject: add header_comment X-Git-Tag: v0.11011~27^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=507693db469e9d279dbbd351216a50b78eac4616;p=dbsrgits%2FSQL-Translator.git add header_comment --- diff --git a/lib/SQL/Translator/Generator/Role/DDL.pm b/lib/SQL/Translator/Generator/Role/DDL.pm index abdd46e..8339a20 100644 --- a/lib/SQL/Translator/Generator/Role/DDL.pm +++ b/lib/SQL/Translator/Generator/Role/DDL.pm @@ -1,6 +1,7 @@ package SQL::Translator::Generator::Role::DDL; use Moo::Role; +use SQL::Translator::Utils qw(header_comment); requires '_build_shim'; requires '_build_type_map'; @@ -69,4 +70,6 @@ sub fields { sub nullable { 'NULL' } +sub header_comments { header_comment() . "\n" if $_[0]->add_comments } + 1; diff --git a/lib/SQL/Translator/Producer/SQLServer.pm b/lib/SQL/Translator/Producer/SQLServer.pm index af171aa..03a8e97 100644 --- a/lib/SQL/Translator/Producer/SQLServer.pm +++ b/lib/SQL/Translator/Producer/SQLServer.pm @@ -6,7 +6,6 @@ our ( $DEBUG, $WARN ); our $VERSION = '1.59'; $DEBUG = 1 unless defined $DEBUG; -use Data::Dumper; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug header_comment); use SQL::Translator::Generator::DDL::SQLServer; @@ -22,13 +21,9 @@ sub produce { my $add_drop_table = $translator->add_drop_table; my $schema = $translator->schema; - my $output; - $output .= header_comment."\n" unless ($no_comments); + my $output = $future->header_comments; + $output .= $future->drop_tables($schema); - # Generate the DROP statements. - $output .= $future->drop_tables; - - # these need to be added separately, as tables may not exist yet my @foreign_constraints = (); for my $table ( grep { $_->name } $schema->get_tables ) {