23 lines
955 B
Python
23 lines
955 B
Python
"""ORM model for recommended questions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import Integer, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
from deerflow.persistence.types import BeijingDateTime
|
|
|
|
|
|
class RecommendedQuestionRow(Base):
|
|
__tablename__ = "recommended_questions"
|
|
|
|
id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
title: Mapped[str] = mapped_column(String(256), nullable=False)
|
|
content: Mapped[str] = mapped_column(Text, nullable=False)
|
|
sort_order: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)
|
|
created_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC))
|
|
updated_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC))
|