demand_belong_category.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from __future__ import annotations
  2. from datetime import datetime
  3. from sqlalchemy import BigInteger, Integer, String, Text, UniqueConstraint, func
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. from supply_infra.db.base import Base
  6. class DemandBelongCategory(Base):
  7. """需求归属分类。"""
  8. __tablename__ = "demand_belong_category"
  9. __table_args__ = (UniqueConstraint("name", name="demand_belong_category_pk"),)
  10. id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
  11. name: Mapped[str | None] = mapped_column(String(256), nullable=True, comment="需求名称")
  12. category_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="分类id")
  13. reason: Mapped[str | None] = mapped_column(Text, nullable=True, comment="原因")
  14. video_list: Mapped[str | None] = mapped_column(
  15. Text, nullable=True, comment="关联视频列表JSON(最多10个)"
  16. )
  17. is_delete: Mapped[int] = mapped_column(
  18. Integer, default=0, nullable=False, comment="是否删除 0-正常 1-删除"
  19. )
  20. create_time: Mapped[datetime] = mapped_column(
  21. nullable=False,
  22. server_default=func.now(),
  23. comment="创建时间",
  24. )
  25. update_time: Mapped[datetime] = mapped_column(
  26. nullable=False,
  27. server_default=func.now(),
  28. onupdate=func.now(),
  29. comment="更新时间",
  30. )