From 9e55431143e48d0ee923e5b6904f450ccf3ca903 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 17 Mar 2012 17:08:46 -0500 Subject: [PATCH] mongo->sql conversion script now runs mongo migrations first, just in case --- mediagoblin/gmg_commands/migrate.py | 9 +++++++-- mediagoblin/gmg_commands/mongosql.py | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mediagoblin/gmg_commands/migrate.py b/mediagoblin/gmg_commands/migrate.py index cacf5d19..af541786 100644 --- a/mediagoblin/gmg_commands/migrate.py +++ b/mediagoblin/gmg_commands/migrate.py @@ -17,7 +17,7 @@ import sys from mediagoblin.db.mongo import util as db_util -from mediagoblin.db.open import setup_connection_and_db_from_config +from mediagoblin.db.mongo.open import setup_connection_and_db_from_config from mediagoblin.init import setup_global_and_app_config # This MUST be imported so as to set up the appropriate migrations! @@ -41,7 +41,12 @@ def _print_finished_migration(migration_number, migration_func): def migrate(args): - global_config, app_config = setup_global_and_app_config(args.conf_file) + run_migrate(args.conf_file) + + +def run_migrate(conf_file): + global_config, app_config = setup_global_and_app_config(conf_file) + connection, db = setup_connection_and_db_from_config( app_config, use_pymongo=True) migration_manager = db_util.MigrationManager(db) diff --git a/mediagoblin/gmg_commands/mongosql.py b/mediagoblin/gmg_commands/mongosql.py index 81a2830c..dd53f575 100644 --- a/mediagoblin/gmg_commands/mongosql.py +++ b/mediagoblin/gmg_commands/mongosql.py @@ -20,5 +20,9 @@ def mongosql_parser_setup(subparser): def mongosql(args): + # First, make sure our mongo migrations are up to date... + from mediagoblin.gmg_commands.migrate import run_migrate + run_migrate(args.conf_file) + from mediagoblin.db.sql.convert import run_conversion run_conversion(args.conf_file) -- 2.25.1