Philipp Hörist pushed to branch master at gajim / gajim
Commits:
690ed499 by Philipp Hörist at 2024-04-12T20:48:18+02:00
cfix: Migration: Don’t fail on missing jids
- - - - -
1 changed file:
- gajim/common/storage/archive/migration.py
Changes:
=====================================
gajim/common/storage/archive/migration.py
=====================================
@@ -64,12 +64,12 @@ class Logs(MappedAsDataclass, MigrationBase, kw_only=True):
log_line_id: Mapped[int] = mapped_column(primary_key=True)
account_id: Mapped[int] = mapped_column(sa.ForeignKey('jids.jid_id'))
- account: Mapped[Jids] = relationship(
+ account: Mapped[Jids | None] = relationship(
lazy='joined', foreign_keys=[account_id], viewonly=True, init=False
)
jid_id: Mapped[int] = mapped_column(sa.ForeignKey('jids.jid_id'))
- remote: Mapped[Jids] = relationship(
+ remote: Mapped[Jids | None] = relationship(
lazy='joined', foreign_keys=[jid_id], viewonly=True, init=False
)
@@ -253,7 +253,22 @@ def _process_message_row(self, conn: sa.Connection,
log_row: Logs) -> None:
m_type, direction = KIND_MAPPING[log_row.kind]
if log_row.time is None:
- raise ValueError('Empty timestamp')
+ log.warning('Unable to migrate message because timestamp is empty')
+ return
+
+ if log_row.account is None:
+ log.warning(
+ 'Unable to migrate message because account_id %s was not
found',
+ log_row.account_id,
+ )
+ return
+
+ if log_row.remote is None:
+ log.warning(
+ 'Unable to migrate message because jid_id %s was not found',
+ log_row.jid_id,
+ )
+ return
account_jid = JID.from_string(log_row.account.jid)
remote_jid = JID.from_string(log_row.remote.jid)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/690ed499681d21985e0c05fc396c471f5b6da52b
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/690ed499681d21985e0c05fc396c471f5b6da52b
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]