From: Arthur Axel 'fREW' Schmidt Date: Tue, 23 Feb 2010 04:10:32 +0000 (-0600) Subject: fix VersionResult to actually work X-Git-Tag: v0.001000_01~148 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0fa32e916221ceed3496613fcbc78c71179f6ce6;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git fix VersionResult to actually work --- diff --git a/lib/DBIx/Class/DeploymentHandler/Component.pm b/lib/DBIx/Class/DeploymentHandler/Component.pm index 0c2ef93..ea7a9ae 100644 --- a/lib/DBIx/Class/DeploymentHandler/Component.pm +++ b/lib/DBIx/Class/DeploymentHandler/Component.pm @@ -1,28 +1,39 @@ -package DBIx::Class::DepolymentHandler::Component; +package DBIx::Class::DeploymentHandler::Component; use strict; use warnings; use Carp 'carp'; +use DBIx::Class::DeploymentHandler::VersionResult; + +sub set_us_up_the_bomb { + my $self = shift; + + $self->register_class( + __VERSION => 'DBIx::Class::DeploymentHandler::VersionResult' + ); +} sub connection { my $self = shift; $self->next::method(@_); + $self->set_us_up_the_bomb; + my $args = $_[3] || {}; return if $args->{ignore_version} || $ENV{DBIC_NO_VERSION_CHECK}; - my $versions = $self->resultset('VersionResult'); + my $versions = $self->resultset('__VERSION'); unless($versions->is_installed) { carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n"; - return 1; + return $self; } my $pversion = $versions->db_version; - return 1 if $pversion eq $self->schema_version; + return $self if $pversion eq $self->schema_version; carp "Versions out of sync. This is " . $self->schema_version . ", your database contains version $pversion, please call upgrade on your Schema.\n";