diff --git a/pyproject.toml b/pyproject.toml index 1f8f77ec18ee8f5d18fb8630e975ea97cd10f6c8..fa3ab3823cda1f1c94003a49fd12af69b87f2d31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ migrate = "flask -A schilder2000 alembic upgrade head" includes = [ "schilder2000/**/*.py", "schilder2000/templates", + "schilder2000/migrations", # Referenced files in manifest.json included via pdm_build.py ] diff --git a/schilder2000/cli.py b/schilder2000/cli.py index 46199455a881de660a4d5fbdb4572d7efe516490..1d8b98c0a04671b65dc169fee157a2c7291a1e56 100644 --- a/schilder2000/cli.py +++ b/schilder2000/cli.py @@ -1,5 +1,7 @@ import sys +import os from os.path import basename +from pathlib import Path import click from flask.cli import with_appcontext @@ -13,6 +15,8 @@ from alembic import config @with_appcontext def alembic(argv): """Wrap the alembic CLI tool.""" + configfile = Path(__file__).parent / "migrations" / "alembic.ini" + os.environ.setdefault("ALEMBIC_CONFIG", str(configfile)) prog = " ".join([basename(sys.argv[0]), sys.argv[1]]) cli = config.CommandLine(prog=prog) cli.main(argv=argv) diff --git a/alembic.ini b/schilder2000/migrations/alembic.ini similarity index 94% rename from alembic.ini rename to schilder2000/migrations/alembic.ini index 358051bb3468d4340e3517f5a1c54f2d0ede1829..a12d1f38dadd5c81f4ccb3c6b912f29c672ce5ef 100644 --- a/alembic.ini +++ b/schilder2000/migrations/alembic.ini @@ -1,5 +1,5 @@ [alembic] -script_location = schilder2000/migrations +script_location = %(here)s [post_write_hooks] hooks = ruff ruff_format