Update app/db.py
Browse files
app/db.py
CHANGED
@@ -55,6 +55,18 @@ async def get_user_db(session: AsyncSession = Depends(get_async_session)):
|
|
55 |
yield SQLAlchemyUserDatabase(session, User)
|
56 |
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
async def connect() -> None:
|
59 |
async with engine.begin() as conn:
|
60 |
await conn.run_sync(Base.metadata.create_all, checkfirst=True)
|
@@ -63,3 +75,4 @@ async def connect() -> None:
|
|
63 |
async def disconnect() -> None:
|
64 |
if engine:
|
65 |
await engine.dispose()
|
|
|
|
55 |
yield SQLAlchemyUserDatabase(session, User)
|
56 |
|
57 |
|
58 |
+
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
|
59 |
+
async with async_session() as session:
|
60 |
+
assert isinstance(session, AsyncSession)
|
61 |
+
yield session
|
62 |
+
|
63 |
+
|
64 |
+
async def connect() -> None:
|
65 |
+
async with engine.begin() as conn:
|
66 |
+
await conn.run_sync(Base.metadata.create_all, checkfirst=True)
|
67 |
+
|
68 |
+
|
69 |
+
"""
|
70 |
async def connect() -> None:
|
71 |
async with engine.begin() as conn:
|
72 |
await conn.run_sync(Base.metadata.create_all, checkfirst=True)
|
|
|
75 |
async def disconnect() -> None:
|
76 |
if engine:
|
77 |
await engine.dispose()
|
78 |
+
"""
|