Files
zpark-ems/scripts/init_db.py
Du Wenbo 026c837b91 Squashed 'core/' content from commit 92ec910
git-subtree-dir: core
git-subtree-split: 92ec910a132e379a3a6e442a75bcb07cac0f0010
2026-04-04 18:17:10 +08:00

19 lines
430 B
Python

"""数据库初始化 - 创建所有表"""
import asyncio
import sys
sys.path.insert(0, "../backend")
from app.core.database import engine, Base
from app.models import * # noqa: F401, F403
async def init():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
print("All tables created successfully!")
await engine.dispose()
if __name__ == "__main__":
asyncio.run(init())