first functionable

This commit is contained in:
Julian Freeman
2025-10-18 13:46:48 -04:00
parent bb2f687c91
commit 4348671562
5 changed files with 219 additions and 1 deletions

11
create_db.py Normal file
View File

@@ -0,0 +1,11 @@
from api_server import Base, engine
print("连接数据库 ...")
# 从 api_server.py 导入 Base (包含了所有模型) 和 engine (数据库连接)
print("创建表(如果表不存在)...")
# create_all 默认会检查表是否存在 (checkfirst=True),所以重复运行是安全的
# 但我们只在需要时手动运行它
Base.metadata.create_all(bind=engine, checkfirst=True)
print("数据表创建成功(或已经存在)。")