From: Arthur Axel 'fREW' Schmidt Date: Sun, 4 Jul 2010 05:48:57 +0000 (-0500) Subject: Run all serialized-sql files if we are not generating ddl X-Git-Tag: v0.001002~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ea5caf534b93bc35ca40c91475a912f70b62a5b;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git Run all serialized-sql files if we are not generating ddl --- diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 1a1fda8..9664009 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -296,7 +296,7 @@ sub deploy { my $sql; if ($self->ignore_ddl) { $sql = $self->_sql_from_yaml({}, - '_ddl_protoschema_produce_filename', $sqlt_type + '_ddl_protoschema_deploy_consume_filenames', $sqlt_type ); } return $self->_run_sql_and_perl($self->_ddl_schema_consume_filenames( @@ -413,19 +413,25 @@ method _sql_from_yaml($sqltargs, $from_file, $db) { my $schema = $self->schema; my $version = $self->schema_version; - my $sqlt = SQL::Translator->new({ - add_drop_table => 0, - parser => 'SQL::Translator::Parser::YAML', - %{$sqltargs}, - producer => $db, - }); + my @sql; - my $yaml_filename = $self->$from_file($version); - - my @sql = $sqlt->translate($yaml_filename); - if(!@sql) { - carp("Failed to translate to $db, skipping. (" . $sqlt->error . ")"); - return undef; + my $actual_file = $self->$from_file($version); + for my $yaml_filename (@{ + DlogS_trace { "generating SQL from Serialized SQL Files: $_" } + (ref $actual_file?$actual_file:[$actual_file]) + }) { + my $sqlt = SQL::Translator->new({ + add_drop_table => 0, + parser => 'SQL::Translator::Parser::YAML', + %{$sqltargs}, + producer => $db, + }); + + push @sql, $sqlt->translate($yaml_filename); + if(!@sql) { + carp("Failed to translate to $db, skipping. (" . $sqlt->error . ")"); + return undef; + } } return \@sql; }