add docker

This commit is contained in:
Julian Freeman
2025-10-18 15:34:41 -04:00
parent 4348671562
commit b4ee793b6f
7 changed files with 221 additions and 9 deletions

View File

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