Add Message model
This commit is contained in:
parent
4714987f3c
commit
dd686ed103
@ -8,8 +8,8 @@ class Message(Base):
|
||||
__tablename__ = "messages"
|
||||
|
||||
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||
sender_id = Column(String, ForeignKey("users.id"), nullable=False, index=True)
|
||||
receiver_id = Column(String, ForeignKey("users.id"), nullable=False, index=True)
|
||||
sender_id = Column(String, ForeignKey("users.id"), nullable=False)
|
||||
recipient_id = Column(String, ForeignKey("users.id"), nullable=False)
|
||||
content = Column(String, nullable=False)
|
||||
is_read = Column(Boolean, default=False)
|
||||
|
||||
@ -17,4 +17,4 @@ class Message(Base):
|
||||
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
||||
|
||||
sender = relationship("User", foreign_keys=[sender_id], back_populates="sent_messages")
|
||||
receiver = relationship("User", foreign_keys=[receiver_id], back_populates="received_messages")
|
||||
recipient = relationship("User", foreign_keys=[recipient_id], back_populates="received_messages")
|
Loading…
x
Reference in New Issue
Block a user