diff --git a/shopdb/core/api/shopdbbackups.py b/shopdb/core/api/shopdbbackups.py index f2f69cb1..4081cc80 100644 --- a/shopdb/core/api/shopdbbackups.py +++ b/shopdb/core/api/shopdbbackups.py @@ -113,11 +113,17 @@ def _current_schema_revisions(): return {} root = current_app.root_path - ini = os.path.join(os.path.dirname(root), 'migrations', 'alembic.ini') + migrations = os.path.join(os.path.dirname(root), 'migrations') + ini = os.path.join(migrations, 'alembic.ini') if not os.path.isfile(ini): return {} try: config = Config(ini) + # This is a Flask-Migrate project: alembic.ini carries no + # script_location (it is set at runtime), so ScriptDirectory.from_config + # would raise and leave every set reading as incompatible. Point it at + # the migrations directory - the same versions tree manifest.py scans. + config.set_main_option('script_location', migrations) script = ScriptDirectory.from_config(config) return {'core': list(script.get_heads())} except Exception: