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:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user