feat: add superseded column to Download model
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from sqlalchemy import String, Integer, Text, ForeignKey, BigInteger
|
||||
from sqlalchemy import String, Integer, Text, ForeignKey, BigInteger, Boolean
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
@@ -55,6 +55,9 @@ class Download(Base, TimestampMixin):
|
||||
file_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
total_size: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True)
|
||||
|
||||
# Superseded: True if a later successful download has run for this source
|
||||
superseded: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False, server_default="false")
|
||||
|
||||
# Timing
|
||||
started_at: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
||||
completed_at: Mapped[Optional[datetime]] = mapped_column(nullable=True)
|
||||
@@ -82,6 +85,7 @@ class Download(Base, TimestampMixin):
|
||||
"total_size": self.total_size,
|
||||
"started_at": format_datetime(self.started_at),
|
||||
"completed_at": format_datetime(self.completed_at),
|
||||
"superseded": self.superseded,
|
||||
"metadata": self.metadata_,
|
||||
"created_at": format_datetime(self.created_at),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user