From 482d53cd30229798ff58f9d6f3cbb3b86f94f218 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 30 Jul 2011 12:33:57 -0500 Subject: [PATCH] Let users know when their migrations are from the future :O --- mediagoblin/init/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mediagoblin/init/__init__.py b/mediagoblin/init/__init__.py index 64fa9b92..ff005703 100644 --- a/mediagoblin/init/__init__.py +++ b/mediagoblin/init/__init__.py @@ -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, -- 2.25.1