20 lines
664 B
Python
20 lines
664 B
Python
"""
|
|
Database models and connection management for Authentication Service.
|
|
Re-exports shared module components for backward compatibility.
|
|
"""
|
|
|
|
# Re-export everything from the shared module
|
|
from shared.models import Base, get_db, engine, AsyncSessionLocal, User
|
|
|
|
__all__ = ["Base", "get_db", "engine", "AsyncSessionLocal", "User"]
|
|
|
|
|
|
async def create_tables():
|
|
"""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}")
|