diff options
author | Boris Bobrov <breton@cynicmansion.ru> | 2017-04-01 21:07:01 +0300 |
---|---|---|
committer | Boris Bobrov <breton@cynicmansion.ru> | 2017-04-01 21:07:01 +0300 |
commit | a5dae0dbc2dc7036a117589555e3a5b0bf10f596 (patch) | |
tree | debe85328325813aa73a8e9201b72c8dad74d5b5 /mediagoblin/gmg_commands | |
parent | 3bad5310f683f2512e5d184555aa0108fbd3ff4b (diff) | |
download | mediagoblin-a5dae0dbc2dc7036a117589555e3a5b0bf10f596.tar.lz mediagoblin-a5dae0dbc2dc7036a117589555e3a5b0bf10f596.tar.xz mediagoblin-a5dae0dbc2dc7036a117589555e3a5b0bf10f596.zip |
Commit session after alembic updates have finished
After alembic updates we need to add foundations. The tables to add
foundations to are created as part of dbupdate process. For some reason
Alembic doesn't commit a session in the end. Because the session is not
commited, the tables do not really get created. And because of that,
foundations fail.
The solution is to commit the session after alembic updates.
Diffstat (limited to 'mediagoblin/gmg_commands')
-rw-r--r-- | mediagoblin/gmg_commands/dbupdate.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py index bafe76bb..2700ccbc 100644 --- a/mediagoblin/gmg_commands/dbupdate.py +++ b/mediagoblin/gmg_commands/dbupdate.py @@ -133,7 +133,9 @@ def run_alembic_migrations(db, app_config, global_config): session = Session() cfg = build_alembic_config(global_config, None, session) - return command.upgrade(cfg, 'heads') + res = command.upgrade(cfg, 'heads') + session.commit() + return res def run_dbupdate(app_config, global_config): @@ -146,7 +148,7 @@ def run_dbupdate(app_config, global_config): # Set up the database db = setup_connection_and_db_from_config(app_config, migrations=True) - # Do we have migrations + # Do we have migrations should_run_sqam_migrations = db.engine.has_table("core__migrations") and \ sqam_migrations_to_run(db, app_config, global_config) |