diff --git a/swh/storage/converters.py b/swh/storage/converters.py --- a/swh/storage/converters.py +++ b/swh/storage/converters.py @@ -83,7 +83,7 @@ def db_to_date( - date: Optional[datetime.datetime], offset: int, neg_utc_offset: bool + date: Optional[datetime.datetime], offset: int, neg_utc_offset: Optional[bool] ) -> Optional[TimestampWithTimezone]: """Convert the DB representation of a date to a swh-model compatible date. @@ -100,6 +100,10 @@ if date is None: return None + if neg_utc_offset is None: + # For older versions of the database that were not migrated to schema v160 + neg_utc_offset = False + return TimestampWithTimezone( timestamp=Timestamp( seconds=int(date.timestamp()), microseconds=date.microsecond,