"""实验模型""" from typing import Optional from sqlalchemy import BigInteger, Float, ForeignKey, Integer, Text, VARCHAR from sqlalchemy.orm import Mapped, mapped_column from .base import Base from .types import JSONB 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) experiment_type: Mapped[Optional[str]] = mapped_column(VARCHAR(64), nullable=True, index=True) baseline_release_id: Mapped[Optional[int]] = mapped_column(Integer, nullable=True, index=True) candidate_release_id: Mapped[Optional[int]] = mapped_column(Integer, nullable=True, index=True) scope_json: Mapped[Optional[object]] = mapped_column(JSONB, nullable=True) result_summary: Mapped[Optional[object]] = mapped_column(JSONB, nullable=True) decision: Mapped[Optional[str]] = mapped_column(VARCHAR(24), nullable=True, index=True) project_id: Mapped[Optional[int]] = mapped_column( BigInteger, ForeignKey("projects.id"), nullable=True, index=True )