Let users know when their migrations are from the future :O
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Jul 2011 17:33:57 +0000 (12:33 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Jul 2011 17:33:57 +0000 (12:33 -0500)
mediagoblin/init/__init__.py

index 64fa9b9248e13e9c48d30a797262798d560906c0..ff005703053ffddead0f0c12af01d5dacd65384c 100644 (file)
@@ -61,9 +61,16 @@ def setup_database():
 
     # Tiny hack to warn user if our migration is out of date
     if not migration_manager.database_at_latest_migration():
-        print (
-            "*WARNING:* Your migrations are out of date, "
-            "maybe run ./bin/gmg migrate?")
+        db_migration_num = migration_manager.database_current_migration()
+        latest_migration_num = migration_manager.latest_migration()
+        if db_migration_num < latest_migration_num:
+            print (
+                "*WARNING:* Your migrations are out of date, "
+                "maybe run ./bin/gmg migrate?")
+        elif db_migration_num > latest_migration_num:
+            print (
+                "*WARNING:* Your migrations are out of date... "
+                "in fact they appear to be from the future?!")
 
     setup_globals(
         db_connection = connection,