multi_demand_video_point.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from __future__ import annotations
  2. from datetime import datetime
  3. from sqlalchemy import BigInteger, Index, String, Text, func
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. from supply_infra.db.base import Base
  6. POINT_TYPE_INSPIRATION = "inspiration"
  7. POINT_TYPE_PURPOSE = "purpose"
  8. POINT_TYPE_KEY = "key"
  9. POINT_TYPES = (POINT_TYPE_INSPIRATION, POINT_TYPE_PURPOSE, POINT_TYPE_KEY)
  10. class MultiDemandVideoPoint(Base):
  11. """需求池视频点位表 — 灵感点/目的点/关键点按行存储。"""
  12. __tablename__ = "multi_demand_video_point"
  13. __table_args__ = (
  14. Index("idx_multi_demand_video_point_video_type", "video_id", "point_type"),
  15. )
  16. id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
  17. video_id: Mapped[str] = mapped_column(String(64), nullable=False, comment="视频id")
  18. point_type: Mapped[str] = mapped_column(
  19. String(32),
  20. nullable=False,
  21. comment="点类型:inspiration / purpose / key",
  22. )
  23. point_data: Mapped[str | None] = mapped_column(
  24. Text, nullable=True, comment="点"
  25. )
  26. point_desc: Mapped[str | None] = mapped_column(
  27. Text, nullable=True, comment="点描述"
  28. )
  29. create_time: Mapped[datetime] = mapped_column(
  30. nullable=False,
  31. server_default=func.now(),
  32. comment="创建时间",
  33. )
  34. update_time: Mapped[datetime] = mapped_column(
  35. nullable=False,
  36. server_default=func.now(),
  37. onupdate=func.now(),
  38. comment="更新时间",
  39. )