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.
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):
# 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)