__main__.py 525 B

123456789101112131415
  1. """CLI: ``python -m supply_infra.db`` 初始化数据库表。"""
  2. from supply_infra.config import get_infra_settings
  3. from supply_infra.db import init_db
  4. if __name__ == "__main__":
  5. settings = get_infra_settings()
  6. result = init_db()
  7. print(
  8. f"Database ready: {settings.mysql_host}:{settings.mysql_port}/{settings.mysql_database}"
  9. )
  10. if result["created"]:
  11. print("Created tables:", ", ".join(result["created"]))
  12. else:
  13. print("No new tables created (all ORM tables already exist).")