Cascade deleted tracks to playlist_rows and playdates

This commit is contained in:
Keith Edmunds 2025-01-27 14:28:34 +00:00
parent 4927f237ab
commit 2f18ef5f44

View File

@ -147,12 +147,15 @@ class TracksTable(Model):
title: Mapped[str] = mapped_column(String(256), index=True) title: Mapped[str] = mapped_column(String(256), index=True)
playlistrows: Mapped[list[PlaylistRowsTable]] = relationship( playlistrows: Mapped[list[PlaylistRowsTable]] = relationship(
"PlaylistRowsTable", back_populates="track" "PlaylistRowsTable",
back_populates="track",
cascade="all, delete-orphan",
) )
playlists = association_proxy("playlistrows", "playlist") playlists = association_proxy("playlistrows", "playlist")
playdates: Mapped[list[PlaydatesTable]] = relationship( playdates: Mapped[list[PlaydatesTable]] = relationship(
"PlaydatesTable", "PlaydatesTable",
back_populates="track", back_populates="track",
cascade="all, delete-orphan",
lazy="joined", lazy="joined",
) )