oss_log.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. from __future__ import annotations
  2. from datetime import datetime
  3. from sqlalchemy import BigInteger, Integer, String, func
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. from supply_infra.db.base import Base
  6. class OssLog(Base):
  7. """Agent 运行日志在 OSS 上的记录。"""
  8. __tablename__ = "oss_logs"
  9. id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
  10. log_name: Mapped[str | None] = mapped_column(String(256), nullable=True, comment="日志名称")
  11. # DDL 示例里误标为 int;按业务存 agent 名称字符串
  12. agent_name: Mapped[str | None] = mapped_column(String(256), nullable=True, comment="agent名称")
  13. oss_path: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="oss路径")
  14. is_delete: Mapped[int] = mapped_column(
  15. Integer, default=0, nullable=False, comment="是否删除 0-正常 1-删除"
  16. )
  17. create_time: Mapped[datetime] = mapped_column(
  18. nullable=False,
  19. server_default=func.now(),
  20. comment="创建时间",
  21. )
  22. update_time: Mapped[datetime] = mapped_column(
  23. nullable=False,
  24. server_default=func.now(),
  25. onupdate=func.now(),
  26. comment="更新时间",
  27. )