fix(orm): disambiguate Chat<->Message relationships
All checks were successful
CI / test (push) Successful in 26s
All checks were successful
CI / test (push) Successful in 26s
- set explicit foreign_keys for Chat.messages and Message.chat - resolve mapper initialization error after pinned_message_id fk
This commit is contained in:
@@ -49,7 +49,7 @@ class Message(Base):
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
chat: Mapped["Chat"] = relationship(back_populates="messages")
|
||||
chat: Mapped["Chat"] = relationship(back_populates="messages", foreign_keys=[chat_id])
|
||||
sender: Mapped["User"] = relationship(back_populates="sent_messages")
|
||||
attachments: Mapped[list["Attachment"]] = relationship(back_populates="message", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user