"""实验模型""" from .base import Base from .types import JSONB from sqlalchemy.orm import Mapped, mapped_column from sqlalchemy import BigInteger, Integer, VARCHAR, Text, Float, ForeignKey from typing import Optional class Experiment(Base): __tablename__ = "experiments" id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) title: Mapped[Optional[str]] = mapped_column(VARCHAR(255), nullable=True) hypothesis: Mapped[Optional[str]] = mapped_column(Text, nullable=True) status: Mapped[str] = mapped_column(VARCHAR(50), nullable=False, default="draft") target_metric: Mapped[Optional[str]] = mapped_column(VARCHAR(50), nullable=True) current_score: Mapped[Optional[float]] = mapped_column(Float, nullable=True) linked_context_nodes: Mapped[Optional[object]] = mapped_column(JSONB, nullable=True) project_id: Mapped[Optional[int]] = mapped_column( BigInteger, ForeignKey("projects.id"), nullable=True, index=True )