[Bast-commits] r4107 - DBIx-Class/0.08/branches/versioned_enhancements/lib/DBIx/Class/Schema

captainL at dev.catalyst.perl.org captainL at dev.catalyst.perl.org
Thu Feb 28 16:11:44 GMT 2008


Author: captainL
Date: 2008-02-28 16:11:44 +0000 (Thu, 28 Feb 2008)
New Revision: 4107

Modified:
   DBIx-Class/0.08/branches/versioned_enhancements/lib/DBIx/Class/Schema/Versioned.pm
Log:
cleaned up get_db_version

Modified: DBIx-Class/0.08/branches/versioned_enhancements/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/versioned_enhancements/lib/DBIx/Class/Schema/Versioned.pm	2008-02-28 10:54:28 UTC (rev 4106)
+++ DBIx-Class/0.08/branches/versioned_enhancements/lib/DBIx/Class/Schema/Versioned.pm	2008-02-28 16:11:44 UTC (rev 4107)
@@ -147,18 +147,12 @@
     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




More information about the Bast-commits mailing list