This repository has been archived on 2025-12-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
safe-marks-server/create_db.py
2025-10-18 13:46:48 -04:00

12 lines
446 B
Python

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("数据表创建成功(或已经存在)。")