Automated Action 667fee7466 Fix database migration issues
- Add project root to Python path in migrations/env.py
- Change database URL configuration to ensure database directory exists
- Update alembic.ini to use relative database path
- Make database URL configuration more resilient
2025-06-06 11:36:18 +00:00

20 lines
500 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
# Note: Directory creation is now handled in the settings property
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
# Dependency for database session
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()