| 1234567891011121314151617181920212223 |
- from datetime import datetime
- from sqlalchemy import BigInteger, DateTime, Integer, SmallInteger, String, func
- from sqlalchemy.orm import Mapped, mapped_column
- from app.database import Base
- from app.models.base import SoftDeleteMixin
- class Attachment(Base, SoftDeleteMixin):
- __tablename__ = "bx_attachment"
- id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
- biz_type: Mapped[str] = mapped_column(String(32), nullable=False)
- biz_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
- file_name: Mapped[str] = mapped_column(String(256), nullable=False)
- file_path: Mapped[str] = mapped_column(String(512), nullable=False)
- file_type: Mapped[str | None] = mapped_column(String(128))
- file_size: Mapped[int | None] = mapped_column(BigInteger)
- attach_type: Mapped[str] = mapped_column(String(32), default="attachment", server_default="attachment")
- sort_order: Mapped[int] = mapped_column(Integer, nullable=False, default=0, server_default="0")
- create_by: Mapped[str | None] = mapped_column(String(64))
- create_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|