Philipp Hörist pushed to branch master at gajim / gajim


Commits:
a26ce118 by Philipp Hörist at 2024-04-12T21:15:48+02:00
cfix: Migration: Don’t fail on missing jids in mam migration

- - - - -


1 changed file:

- gajim/common/storage/archive/migration.py


Changes:

=====================================
gajim/common/storage/archive/migration.py
=====================================
@@ -45,7 +45,7 @@ class LastArchiveMessage(MappedAsDataclass, MigrationBase, 
kw_only=True):
     __tablename__ = 'last_archive_message'
 
     jid_id: Mapped[int] = mapped_column(sa.ForeignKey('jids.jid_id'), 
primary_key=True)
-    remote: Mapped[Jids] = relationship(lazy='joined', viewonly=True, 
init=False)
+    remote: Mapped[Jids | None] = relationship(lazy='joined', viewonly=True, 
init=False)
     last_mam_id: Mapped[str | None]
     oldest_mam_timestamp: Mapped[float | None]
     last_muc_timestamp: Mapped[float | None]
@@ -220,6 +220,14 @@ def _process_archive_row(
         archive_row: LastArchiveMessage,
         account_pks: list[int],
     ) -> None:
+
+        if archive_row.remote is None:
+            log.warning(
+                'Unable to migrate mam state because jid_id %s was not found',
+                archive_row.jid_id,
+            )
+            return
+
         remote_jid = JID.from_string(archive_row.remote.jid)
         remote_pk = self._get_remote_pk(conn, remote_jid)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a26ce1180d14d9f5dd98c7bbe100fbeb85fa1d8a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a26ce1180d14d9f5dd98c7bbe100fbeb85fa1d8a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to