#!/usr/bin/env python # -*- coding: utf-8 -*- """ Helper script to run Alembic migrations with the correct Python path. Usage: python run_migrations.py upgrade head python run_migrations.py revision --autogenerate -m "description" python run_migrations.py --help """ import sys from pathlib import Path # Add the project root directory to the Python path BASE_DIR = Path(__file__).resolve().parent sys.path.append(str(BASE_DIR)) print(f"Added {BASE_DIR} to Python path") if __name__ == "__main__": # Import alembic's main function from alembic.config import main # Execute alembic command with sys.argv (e.g., 'upgrade', 'head') main(argv=sys.argv[1:])