feat: add branching columns to ai_sessions, ai_session_steps, file_uploads
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,8 @@ from app.core.database import Base
|
||||
if TYPE_CHECKING:
|
||||
from app.models.ai_session import AISession
|
||||
from app.models.script_template import ScriptGeneration
|
||||
from app.models.session_branch import SessionBranch
|
||||
from app.models.fork_point import ForkPoint
|
||||
|
||||
|
||||
class AISessionStep(Base):
|
||||
@@ -34,7 +36,7 @@ class AISessionStep(Base):
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"step_type IN ('question', 'action', 'script_generation', 'verification', "
|
||||
"'info_request', 'note', 'intake_analysis')",
|
||||
"'info_request', 'note', 'intake_analysis', 'fork')",
|
||||
name="ck_ai_session_steps_step_type",
|
||||
),
|
||||
)
|
||||
@@ -119,6 +121,24 @@ class AISessionStep(Base):
|
||||
Integer, nullable=False, default=0,
|
||||
)
|
||||
|
||||
# ── Branching ──
|
||||
branch_id: Mapped[Optional[uuid.UUID]] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("session_branches.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
comment="NULL = pre-branching/root messages",
|
||||
)
|
||||
is_fork_point: Mapped[bool] = mapped_column(
|
||||
default=False,
|
||||
comment="Whether this step triggered a fork",
|
||||
)
|
||||
fork_point_id: Mapped[Optional[uuid.UUID]] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("fork_points.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# ── Timestamps ──
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||
|
||||
Reference in New Issue
Block a user