Fix database migration import path error

- Add project root to Python path in migrations/env.py
- Ensure all models are properly imported in base_models.py
- Fix import statements for proper module resolution
This commit is contained in:
Automated Action 2025-06-08 18:16:20 +00:00
parent d4b0ceed9c
commit 11dd11a6ff

View File

@ -1,8 +1,14 @@
import sys
from logging.config import fileConfig from logging.config import fileConfig
from pathlib import Path
from alembic import context from alembic import context
from sqlalchemy import engine_from_config, pool from sqlalchemy import engine_from_config, pool
# Add the project root directory to the Python path
# This ensures that the 'app' module can be imported correctly
sys.path.insert(0, str(Path(__file__).parent.parent))
# Import all models for Alembic to detect # Import all models for Alembic to detect
# Import Base from our app for auto-generating migrations # Import Base from our app for auto-generating migrations
from app.db.base import Base from app.db.base import Base