Move the AlembicMigrationManager to top of the module.
authorBerker Peksag <berker.peksag@gmail.com>
Fri, 15 Aug 2014 12:40:35 +0000 (15:40 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Fri, 15 Aug 2014 12:40:35 +0000 (15:40 +0300)
Also, add a simple docstring.

mediagoblin/gmg_commands/dbupdate.py

index 7039b95ce0c681e3a638fa1b046d8c59b81aacf3..f5c20720aaede6c3895290403861e6dd5abecd1a 100644 (file)
@@ -19,7 +19,7 @@ import logging
 from sqlalchemy.orm import sessionmaker
 
 from mediagoblin.db.open import setup_connection_and_db_from_config
-from mediagoblin.db.migration_tools import MigrationManager
+from mediagoblin.db.migration_tools import MigrationManager, AlembicMigrationManager
 from mediagoblin.init import setup_global_and_app_config
 from mediagoblin.tools.common import import_component
 
@@ -107,7 +107,7 @@ forgotten to add it? ({1})'.format(plugin, exc))
 
 
 def run_alembic_migrations(db, app_config, global_config):
-    from mediagoblin.db.migration_tools import AlembicMigrationManager
+    """Initializes a database and runs all Alembic migrations."""
     Session = sessionmaker(bind=db.engine)
     manager = AlembicMigrationManager(Session())
     manager.init_or_migrate()