"""backup_blob: a library file already sent to the off-site bucket. One row per (destination, sha256). `target` names the destination as "/", so pointing backups at another bucket leaves these rows inert and that bucket's copy starts from the beginning. `key` is where the file sits in the bucket (`media/ab/cd/`). """ from datetime import datetime from sqlalchemy import BigInteger, DateTime, String, Text, func from sqlalchemy.orm import Mapped, mapped_column from .base import Base class BackupBlob(Base): __tablename__ = "backup_blob" target: Mapped[str] = mapped_column(Text, primary_key=True) sha256: Mapped[str] = mapped_column(String(64), primary_key=True) key: Mapped[str] = mapped_column(Text, nullable=False) size_bytes: Mapped[int] = mapped_column(BigInteger, nullable=False) uploaded_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), nullable=False, server_default=func.now(), )