aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/dbupdate.py
diff options
context:
space:
mode:
authorAditi <aditi.iitr@gmail.com>2013-07-04 21:35:22 +0530
committerAditi <aditi.iitr@gmail.com>2013-07-04 21:35:22 +0530
commit7b77f7e490a27de57a4dab5301662ef95d11b213 (patch)
tree9b87d1720e64565e42970bcc24625ff6bfd8fa85 /mediagoblin/gmg_commands/dbupdate.py
parent2392fbc02bbf6d05d998de5091b8f11f37c101f0 (diff)
parent41a14c6efc1dd9cfc36f1b2eb4cb3f3b34e4d975 (diff)
downloadmediagoblin-7b77f7e490a27de57a4dab5301662ef95d11b213.tar.lz
mediagoblin-7b77f7e490a27de57a4dab5301662ef95d11b213.tar.xz
mediagoblin-7b77f7e490a27de57a4dab5301662ef95d11b213.zip
Merge remote-tracking branch 'cweb/master'
sage aborts Merge branch master of git://gitorious.org/mediagoblin/mediagoblin.git
Diffstat (limited to 'mediagoblin/gmg_commands/dbupdate.py')
-rw-r--r--mediagoblin/gmg_commands/dbupdate.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py
index fa25ecb2..22ad426c 100644
--- a/mediagoblin/gmg_commands/dbupdate.py
+++ b/mediagoblin/gmg_commands/dbupdate.py
@@ -110,14 +110,26 @@ def run_dbupdate(app_config, global_config):
in the future, plugins)
"""
+ # Set up the database
+ db = setup_connection_and_db_from_config(app_config, migrations=True)
+ #Run the migrations
+ run_all_migrations(db, app_config, global_config)
+
+
+def run_all_migrations(db, app_config, global_config):
+ """
+ Initializes or migrates a database that already has a
+ connection setup and also initializes or migrates all
+ extensions based on the config files.
+
+ It can be used to initialize an in-memory database for
+ testing.
+ """
# Gather information from all media managers / projects
dbdatas = gather_database_data(
app_config['media_types'],
global_config.get('plugins', {}).keys())
- # Set up the database
- db = setup_connection_and_db_from_config(app_config, migrations=True)
-
Session = sessionmaker(bind=db.engine)
# Setup media managers for all dbdata, run init/migrate and print info