Skip to content
Snippets Groups Projects
Commit 945d0db1 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Move alembic.ini inside Python package

Before this, it was not shipped with the sdist or wheel and thus migrations were
unavailable for package-based installs.
parent 9fbd628f
No related branches found
No related tags found
No related merge requests found
......@@ -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
]
......
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)
[alembic]
script_location = schilder2000/migrations
script_location = %(here)s
[post_write_hooks]
hooks = ruff ruff_format
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment