fix: cascade delete download_logs when video is deleted

DownloadLog has ondelete=CASCADE on FK but ORM relationship lacked
cascade='all, delete-orphan', causing IntegrityError (NOT NULL) on
video deletion.
This commit is contained in:
mini
2026-02-19 01:00:51 +08:00
parent d419158c80
commit b5c50b0779

View File

@@ -30,7 +30,7 @@ class Video(Base):
Index("ix_video_url_format_id", "url", "format_id"), Index("ix_video_url_format_id", "url", "format_id"),
) )
logs = relationship("DownloadLog", back_populates="video", lazy="select") logs = relationship("DownloadLog", back_populates="video", lazy="select", cascade="all, delete-orphan")
class DownloadLog(Base): class DownloadLog(Base):