X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02-instantiation.t;h=c7fde9b74a519cb622e1ca9437816073134353c9;hb=a912450b8ca3f98fa8ef136ec40c77817e6cf4c9;hp=4efc955f03b2d8791965b181dcc2eba953532098;hpb=9d737292631c7149ccf16d34d261ef2fa1949b15;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git diff --git a/t/02-instantiation.t b/t/02-instantiation.t index 4efc955..c7fde9b 100644 --- a/t/02-instantiation.t +++ b/t/02-instantiation.t @@ -7,29 +7,31 @@ use lib 't/lib'; use DBICTest; use DBIx::Class::DeploymentHandler; my $db = 'dbi:SQLite:db.db'; +my @connection = ($db, '', '', { ignore_version => 1 }); my $sql_dir = 't/sql'; unlink 'db.db' if -e 'db.db'; if (-d 't/sql') { - unlink $_ for glob('t/sql/*'); + unlink $_ for glob('t/sql/*'); } else { - mkdir 't/sql'; + mkdir 't/sql'; } VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 1.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, schema => $s, databases => 'SQLite', + sqltargs => { add_drop_table => 0 }, }); ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly'); my $version = $s->schema_version(); - $handler->create_install_ddl(); + $handler->prepare_install(); ok(-e 't/sql/DBICVersion-Schema-1.0-SQLite.sql', 'DDL for 1.0 got created successfully'); dies_ok { @@ -47,7 +49,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 2.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, @@ -58,7 +60,7 @@ VERSION2: { ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly'); $version = $s->schema_version(); - $handler->create_install_ddl(); + $handler->prepare_install(); $handler->create_update_ddl($version, '1.0'); ok(-e 't/sql/DBICVersion-Schema-2.0-SQLite.sql', 'DDL for 2.0 got created successfully'); ok(-e 't/sql/DBICVersion-Schema-1.0-2.0-SQLite.sql', 'DDL for migration from 1.0 to 2.0 got created successfully'); @@ -75,7 +77,7 @@ VERSION2: { baz => 'frew', }) } 'schema not uppgrayyed'; - $handler->upgrade_single_step('1.0', '2.0'); + $handler->upgrade_single_step(['1.0', '2.0']); lives_ok { $s->resultset('Foo')->create({ bar => 'frew', @@ -86,7 +88,7 @@ VERSION2: { VERSION3: { use_ok 'DBICVersion_v3'; - my $s = DBICVersion::Schema->connect($db); + my $s = DBICVersion::Schema->connect(@connection); ok($s, 'DBICVersion::Schema 3.0 instantiates correctly'); my $handler = DBIx::Class::DeploymentHandler->new({ upgrade_directory => $sql_dir, @@ -97,7 +99,7 @@ VERSION3: { ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly'); $version = $s->schema_version(); - $handler->create_install_ddl; + $handler->prepare_install; $handler->create_update_ddl( $version, '1.0'); $handler->create_update_ddl( $version, '2.0'); ok(-e 't/sql/DBICVersion-Schema-3.0-SQLite.sql', 'DDL for 3.0 got created successfully'); @@ -123,4 +125,4 @@ VERSION3: { done_testing; __END__ -vim: ts=2,sw=2,expandtab +vim: ts=2 sw=2 expandtab