Files
dpb/_validate_tables.py
34047007@qq.com b95053c52c init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
2026-08-06 00:17:49 +08:00

26 lines
734 B
Python

# -*- coding: utf-8 -*-
"""验证 bre 全部模型可成功建表(不触发重复索引/DuplicateTableError)。"""
import asyncio
import os
import sys
os.environ["ENVIRONMENT"] = "dev"
sys.path.insert(0, "d:/dpb/dpb/backend")
from app.api.v1.module_bre import bre_router # noqa: F401 触发模型注册
from app.core.base_model import MappedBase # noqa: E402
from app.core.database import create_tables # noqa: E402
async def main():
await create_tables()
tables = sorted(t for t in MappedBase.metadata.tables.keys() if t.startswith("bre_"))
print("CREATE_TABLES_OK")
print("bre tables count =", len(tables))
for t in tables:
print(" -", t)
if __name__ == "__main__":
asyncio.run(main())