mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-03 13:19:23 +08:00
Fix an issue when a credential is deleted, resuming of download fails.
This commit is contained in:
parent
e70f524d5f
commit
9c845eeb9e
@ -65,7 +65,12 @@ class Download(Base):
|
||||
expected_sha256: Mapped[str | None] = mapped_column(String(64), nullable=True)
|
||||
|
||||
# Explicit credential override; otherwise auto-resolved by host.
|
||||
credential_id: Mapped[str | None] = mapped_column(String(36), nullable=True)
|
||||
# RESTRICT keeps a credential from being deleted while a download references it.
|
||||
credential_id: Mapped[str | None] = mapped_column(
|
||||
String(36),
|
||||
ForeignKey("host_credentials.id", ondelete="RESTRICT"),
|
||||
nullable=True,
|
||||
)
|
||||
allow_any_extension: Mapped[bool] = mapped_column(
|
||||
Boolean, nullable=False, default=False
|
||||
)
|
||||
@ -86,6 +91,10 @@ class Download(Base):
|
||||
order_by="DownloadSegment.idx",
|
||||
)
|
||||
|
||||
credential: Mapped[HostCredential | None] = relationship(
|
||||
"HostCredential", back_populates="downloads"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_downloads_status", "status"),
|
||||
Index("ix_downloads_priority", "priority"),
|
||||
@ -152,6 +161,10 @@ class HostCredential(Base):
|
||||
BigInteger, nullable=False, default=_now, onupdate=_now
|
||||
)
|
||||
|
||||
downloads: Mapped[list[Download]] = relationship(
|
||||
"Download", back_populates="credential"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("uq_host_credentials_host", "host", unique=True),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user