扫码登录,获取cookies
This commit is contained in:
@@ -10,6 +10,10 @@ __all__ = ["Base", "get_db", "engine", "AsyncSessionLocal", "User"]
|
||||
|
||||
|
||||
async def create_tables():
|
||||
"""Create all tables in the database."""
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
"""Create all tables in the database if they don't exist."""
|
||||
try:
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
except Exception as e:
|
||||
# 表已存在或其他错误,忽略
|
||||
print(f"Warning: Could not create tables: {e}")
|
||||
|
||||
Reference in New Issue
Block a user