Fix Python path in migrations/env.py for Alembic database migrations

This commit is contained in:
Automated Action 2025-05-26 14:58:02 +00:00
parent 61a9c8a000
commit 600c8b17af

View File

@ -1,9 +1,14 @@
import sys
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from pathlib import Path
from alembic import context
from sqlalchemy import engine_from_config, pool
# Add the project root directory to the Python path
sys.path.insert(0, str(Path(__file__).parent.parent))
# Now we can import from app
from app.db.base import Base
# this is the Alembic Config object, which provides
@ -80,4 +85,4 @@ def run_migrations_online() -> None:
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
run_migrations_online()