From: Arthur Axel 'fREW' Schmidt Date: Sun, 6 May 2012 04:37:51 +0000 (-0500) Subject: Correctly set the version deployed to the version requested on install X-Git-Tag: v0.002114~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=27da120a50905a6c6d660f05a7034bba6f38fdc1;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git Correctly set the version deployed to the version requested on install --- diff --git a/Changes b/Changes index bf65c2b..01fd586 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for {{$dist->name}} {{$NEXT}} + - Correctly set the version deployed to the version requested on install + instead of just the current schema version 0.002113 2012-05-05 23:09:33 America/Chicago - Remove isa check on schema attributes so that you may pass the schema diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index d9e4b27..f06336f 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -51,7 +51,7 @@ sub install { my $ddl = $self->deploy({ version=> $version }); $self->add_database_version({ - version => $self->to_version, + version => $version, ddl => $ddl, }); }); diff --git a/t/02-instantiation-wo-component.t b/t/02-instantiation-wo-component.t index b5fee69..0eabb14 100644 --- a/t/02-instantiation-wo-component.t +++ b/t/02-instantiation-wo-component.t @@ -55,6 +55,20 @@ VERSION2: { use_ok 'DBICVersion_v2'; my $s = DBICVersion::Schema->connect(@connection); $DBICVersion::Schema::VERSION = 2; + subtest 'bug deploying first version' => sub { + my $dbh = DBICDHTest::dbh(); + my @connection = (sub { $dbh }, { ignore_version => 1 }); + my $s = DBICVersion::Schema->connect(@connection); + + my $handler = DH->new({ + script_directory => $sql_dir, + schema => $s, + databases => 'SQLite', + }); + $handler->install({ version => 1 }); + is($handler->database_version, 1, 'correctly set version to 1'); + }; + ok($s, 'DBICVersion::Schema 2 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir,