Ensure that sqltargs are passed to deploy when ignore_ddl is set
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / DeployMethod / SQL / Translator.pm
index e59c062..0b00dba 100644 (file)
@@ -264,19 +264,20 @@ sub _split_sql_chunk {
         s/^(?:BEGIN|BEGIN TRANSACTION|COMMIT).*//mgi;
 
         # trim whitespaces
-        s/^\s+|\s+$//mg;
+        s/^\s+//gm;
+        s/\s+$//gm;
 
         # remove comments
         s/^--.*//gm;
 
         # remove blank lines
-        s/^\n//mg;
+        s/^\n//gm;
 
         # put on single line
         s/\n/ /g;
     }
 
-    return @sql;
+    return grep $_, @sql;
 }
 
 sub _run_sql {
@@ -359,8 +360,9 @@ sub deploy {
   log_info { "deploying version $version" };
   my $sqlt_type = $self->storage->sqlt_type;
   my $sql;
+  my $sqltargs = $self->sql_translator_args;
   if ($self->ignore_ddl) {
-     $sql = $self->_sql_from_yaml({},
+     $sql = $self->_sql_from_yaml($sqltargs,
        '_ddl_protoschema_deploy_consume_filenames', $sqlt_type
      );
   }