Correctly strip lines that are all whitespace
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / DeployMethod / SQL / Translator.pm
index 9efa8d4..9e2a759 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 {
@@ -483,10 +484,10 @@ sub _sql_from_yaml {
   my @sql;
 
   my $actual_file = $self->$from_file($version);
-  for my $yaml_filename (@{
+  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',