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!
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)
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)