This commit is contained in:
2026-08-25 20:06:52 +08:00
parent e4f846c2cb
commit d827523f2b
10 changed files with 288 additions and 11 deletions
+2 -5
View File
@@ -31,8 +31,5 @@ def get_db():
finally:
db.close()
def init_db() -> None:
"""创建所有表(生产环境建议改用 Alembic 迁移)"""
from . import models # noqa: F401 确保模型被导入
Base.metadata.create_all(bind=engine)
# 注意:本服务不自动建表。
# 数据库结构由 docs/schema.sql 手动初始化(与 models.py 保持同步维护)。