From: Arthur Axel 'fREW' Schmidt Date: Wed, 2 Jun 2010 02:28:51 +0000 (-0500) Subject: Ensure that ignore_ddl works without generated SQL X-Git-Tag: v0.001000_13~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38857f30bc0d5dcae8f67823387be75a3b0d1c9a;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git Ensure that ignore_ddl works without generated SQL --- diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index c298cdd..22f0f9a 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -96,7 +96,11 @@ method __ddl_consume_with_prefix($type, $versions, $prefix) { if (-d $main) { $dir = catfile($main, $prefix, join q(-), @{$versions}) } else { - croak "$main does not exist; please write/generate some SQL"; + if ($self->ignore_ddl) { + return [] + } else { + croak "$main does not exist; please write/generate some SQL" + } } my %files; diff --git a/t/02-instantiation-no-ddl.t b/t/02-instantiation-no-ddl.t index ff169c3..7355f9d 100644 --- a/t/02-instantiation-no-ddl.t +++ b/t/02-instantiation-no-ddl.t @@ -27,7 +27,7 @@ VERSION1: { ignore_ddl => 1, script_directory => $sql_dir, schema => $s, - databases => 'SQLite', + databases => [], sql_translator_args => { add_drop_table => 0 }, }); @@ -61,7 +61,7 @@ VERSION2: { ignore_ddl => 1, script_directory => $sql_dir, schema => $s, - databases => 'SQLite', + databases => [], }); ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly'); @@ -98,7 +98,7 @@ VERSION3: { ignore_ddl => 1, script_directory => $sql_dir, schema => $s, - databases => 'SQLite', + databases => [], }); ok($handler, 'DBIx::Class::DeploymentHandler w/3 instantiates correctly'); @@ -131,7 +131,7 @@ DOWN2: { ignore_ddl => 1, script_directory => $sql_dir, schema => $s, - databases => 'SQLite', + databases => [], }); ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly');