fix: add explicit foreign_keys to all branching model relationships
SQLAlchemy can't resolve ambiguous FK paths when tables have multiple cross-references. All relationships now specify foreign_keys. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@ class SessionHandoff(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
|
||||
|
||||
# Relationships
|
||||
session: Mapped["AISession"] = relationship("AISession")
|
||||
session: Mapped["AISession"] = relationship("AISession", foreign_keys=[session_id])
|
||||
handed_off_by_user: Mapped["User"] = relationship("User", foreign_keys=[handed_off_by])
|
||||
source_branch: Mapped[Optional["SessionBranch"]] = relationship("SessionBranch")
|
||||
source_branch: Mapped[Optional["SessionBranch"]] = relationship("SessionBranch", foreign_keys=[source_branch_id])
|
||||
claimed_by_user: Mapped[Optional["User"]] = relationship("User", foreign_keys=[claimed_by])
|
||||
|
||||
Reference in New Issue
Block a user