[Jifty-commit] r4381 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Nov 6 03:11:42 EST 2007


Author: clkao
Date: Tue Nov  6 03:11:39 2007
New Revision: 4381

Modified:
   jifty/trunk/lib/Jifty/Handle.pm

Log:
Add a ForwardCompatible config in Database section.  The usecase
is that when you switch your checkout to something with older
version of app schema, you can declare it is compatiable with
the future version that is currently in db.


Modified: jifty/trunk/lib/Jifty/Handle.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handle.pm	(original)
+++ jifty/trunk/lib/Jifty/Handle.pm	Tue Nov  6 03:11:39 2007
@@ -91,7 +91,7 @@
 
     my %lc_db_config;
     # Skip the non-dsn keys, but not anything else
-    for (grep {!/^checkschema|version|recordbaseclass|attributes$/i} keys %db_config) {
+    for (grep {!/^checkschema|version|forwardcompatible|recordbaseclass|attributes$/i} keys %db_config) {
         $lc_db_config{lc($_)} = $db_config{$_};
     }
     $self->SUPER::connect( %lc_db_config , %args);
@@ -145,10 +145,15 @@
             . "\t bin/jifty schema --setup\n"
             unless defined $dbv;
 
-        die
+        unless (version->new($appv) == version->new($dbv)) {
+            # if app version is older than db version, but we are still compatible
+            my $compat = delete Jifty->config->framework('Database')->{'ForwardCompatible'} || $appv;
+            warn "==> $compat";
+            die
             "Application schema version in database ($dbv) doesn't match application schema version ($appv)\n"
             . "Please run `bin/jifty schema --setup` to upgrade the database.\n"
-            unless version->new($appv) == version->new($dbv);
+                if version->new($appv) > version->new($dbv) || version->new($compat) < version->new($dbv);
+        }
     }
 
     # Jifty db version check


More information about the Jifty-commit mailing list