From: Luke Saunders Date: Thu, 28 Feb 2008 16:11:44 +0000 (+0000) Subject: cleaned up get_db_version X-Git-Tag: v0.08240~545^2~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7146f14f94f8520f10930918e2953d5d72fc6bdc;p=dbsrgits%2FDBIx-Class.git cleaned up get_db_version --- diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index 1506321..e44f0c5 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -147,18 +147,12 @@ sub get_db_version my ($self, $rs) = @_; my $vtable = $self->{vschema}->resultset('Table'); - return 0 unless ($self->_source_exists($vtable)); - - my $psearch = $vtable->search(undef, - { select => [ - { 'max' => 'Installed' }, - ], - as => ['maxinstall'], - })->first; - my $pversion = $vtable->search({ Installed => $psearch->get_column('maxinstall'), - })->first; - $pversion = $pversion->Version if($pversion); - return $pversion; + my $version; + eval { + my $stamp = $vtable->get_column('Installed')->max; + $version = $vtable->search({ Installed => $stamp })->first->Version; + }; + return $version; } sub _source_exists