Mercurial > libervia-backend
diff libervia/backend/memory/sqla_mapping.py @ 4365:f6672bc80897
storage (mapping): Fix `nullable` for thread ID, and add a `is_retroactive` field:
`is_retroactive` is used to link a thread in a parent message when it didn't have the
thread initially.
rel 457
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 06 May 2025 00:21:24 +0200 |
parents | 0d7bb4df2343 |
children |
line wrap: on
line diff
--- a/libervia/backend/memory/sqla_mapping.py Tue May 06 00:19:43 2025 +0200 +++ b/libervia/backend/memory/sqla_mapping.py Tue May 06 00:21:24 2025 +0200 @@ -40,6 +40,7 @@ event, ) from sqlalchemy.orm import declarative_base, relationship +from sqlalchemy.sql import false from sqlalchemy.sql.functions import now from sqlalchemy.types import TypeDecorator from twisted.words.protocols.jabber import jid @@ -433,8 +434,18 @@ primary_key=True, ) history_uid = Column(ForeignKey("history.uid", ondelete="CASCADE")) - thread_id = Column(Text) - parent_id = Column(Text) + thread_id = Column(Text, nullable=False) + parent_id = Column(Text, nullable=True) + is_retroactive = Column( + Boolean, + default=False, + nullable=False, + server_default=false(), + comment=( + "Indicates if thread ID was added after the original message was sent (e.g. " + "to link a parent message which didn't have a thread ID to a thread)." + ) + ) history = relationship("History", uselist=False, back_populates="thread")