Fix SQLAlchemy mapper init error — remove back_populates from Resos models
KDS uses a minimal Kitchen stub (no resos_* relationship properties) so back_populates="resos_bookings" etc. caused mapper init to fail on every request. Changed all four Resos.kitchen relationships to viewonly=True with no back reference — KDS only reads these, not writes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cd434b3a19
commit
c3d13446fc
1 changed files with 4 additions and 4 deletions
|
|
@ -48,7 +48,7 @@ class ResosBooking(Base):
|
|||
is_forecast: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
# Relationships
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", back_populates="resos_bookings")
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", viewonly=True)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint('kitchen_id', 'resos_booking_id', name='uq_resos_booking'),
|
||||
|
|
@ -87,7 +87,7 @@ class ResosDailyStats(Base):
|
|||
is_forecast: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
# Relationships
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", back_populates="resos_daily_stats")
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", viewonly=True)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint('kitchen_id', 'date', name='uq_resos_daily_stat'),
|
||||
|
|
@ -113,7 +113,7 @@ class ResosOpeningHour(Base):
|
|||
fetched_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
|
||||
# Relationships
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", back_populates="resos_opening_hours")
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", viewonly=True)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint('kitchen_id', 'resos_opening_hour_id', name='uq_resos_opening_hour'),
|
||||
|
|
@ -142,4 +142,4 @@ class ResosSyncLog(Base):
|
|||
completed_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
|
||||
# Relationships
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", back_populates="resos_sync_logs")
|
||||
kitchen: Mapped["Kitchen"] = relationship("Kitchen", viewonly=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue