Update app/db.py
Browse files
app/db.py
CHANGED
@@ -47,3 +47,11 @@ async def get_user_db(session: AsyncSession = Depends(get_async_session)):
|
|
47 |
yield SQLAlchemyUserDatabase(session, User)
|
48 |
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
yield SQLAlchemyUserDatabase(session, User)
|
48 |
|
49 |
|
50 |
+
async def connect() -> None:
|
51 |
+
async with engine.begin() as conn:
|
52 |
+
await conn.run_sync(Base.metadata.create_all, checkfirst=True)
|
53 |
+
|
54 |
+
|
55 |
+
async def disconnect() -> None:
|
56 |
+
if engine:
|
57 |
+
await engine.dispose()
|