16 lines
466 B
Python
16 lines
466 B
Python
"""Run Alembic migrations to head on startup."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from alembic import command
|
|
from alembic.config import Config
|
|
|
|
|
|
def run_migrations() -> None:
|
|
"""Apply all pending Alembic migrations."""
|
|
backend_dir = Path(__file__).resolve().parent.parent
|
|
alembic_cfg = Config(str(backend_dir / "alembic.ini"))
|
|
alembic_cfg.set_main_option("script_location", str(backend_dir / "alembic"))
|
|
command.upgrade(alembic_cfg, "head")
|