Complete backend verification: fix syntax errors, create __init__.py files, add setup_db.py, update docker-compose for two PostgreSQL containers
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Database engine and session management.
|
||||
|
||||
Provides async SQLAlchemy engine and session factory for dependency injection.
|
||||
Supports dual database connections for cockatrice app and mtgjson data.
|
||||
Supports dual database connections for mtgonline app and mtgjson data.
|
||||
"""
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
@@ -10,7 +10,7 @@ from app.core.settings import get_settings
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
# Primary database engine (cockatrice app)
|
||||
# Primary database engine (mtgonline app)
|
||||
engine = create_async_engine(
|
||||
settings.DATABASE_URL,
|
||||
echo=settings.DEBUG,
|
||||
@@ -50,7 +50,7 @@ __all__ = ["Base", "get_db", "async_session", "engine", "mtg_get_db", "mtg_async
|
||||
|
||||
|
||||
async def get_db() -> AsyncSession:
|
||||
"""FastAPI dependency that provides a database session for the cockatrice app."""
|
||||
"""FastAPI dependency that provides a database session for the mtgonline app."""
|
||||
async with async_session() as session:
|
||||
try:
|
||||
yield session
|
||||
|
||||
Reference in New Issue
Block a user