moriire commited on
Commit
ab6f064
1 Parent(s): 8d13d76

Update app/db.py

Browse files
Files changed (1) hide show
  1. app/db.py +8 -0
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()