| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- from __future__ import annotations
- from datetime import datetime
- from sqlalchemy import BigInteger, Index, String, Text, func
- from sqlalchemy.orm import Mapped, mapped_column
- from supply_infra.db.base import Base
- POINT_TYPE_INSPIRATION = "inspiration"
- POINT_TYPE_PURPOSE = "purpose"
- POINT_TYPE_KEY = "key"
- POINT_TYPES = (POINT_TYPE_INSPIRATION, POINT_TYPE_PURPOSE, POINT_TYPE_KEY)
- class MultiDemandVideoPoint(Base):
- """需求池视频点位表 — 灵感点/目的点/关键点按行存储。"""
- __tablename__ = "multi_demand_video_point"
- __table_args__ = (
- Index("idx_multi_demand_video_point_video_type", "video_id", "point_type"),
- )
- id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
- video_id: Mapped[str] = mapped_column(String(64), nullable=False, comment="视频id")
- point_type: Mapped[str] = mapped_column(
- String(32),
- nullable=False,
- comment="点类型:inspiration / purpose / key",
- )
- point_data: Mapped[str | None] = mapped_column(
- Text, nullable=True, comment="点"
- )
- point_desc: Mapped[str | None] = mapped_column(
- Text, nullable=True, comment="点描述"
- )
- create_time: Mapped[datetime] = mapped_column(
- nullable=False,
- server_default=func.now(),
- comment="创建时间",
- )
- update_time: Mapped[datetime] = mapped_column(
- nullable=False,
- server_default=func.now(),
- onupdate=func.now(),
- comment="更新时间",
- )
|