diff --git a/app/dbtables.py b/app/dbtables.py index 1d31e4f..808c301 100644 --- a/app/dbtables.py +++ b/app/dbtables.py @@ -147,12 +147,15 @@ class TracksTable(Model): title: Mapped[str] = mapped_column(String(256), index=True) playlistrows: Mapped[list[PlaylistRowsTable]] = relationship( - "PlaylistRowsTable", back_populates="track" + "PlaylistRowsTable", + back_populates="track", + cascade="all, delete-orphan", ) playlists = association_proxy("playlistrows", "playlist") playdates: Mapped[list[PlaydatesTable]] = relationship( "PlaydatesTable", back_populates="track", + cascade="all, delete-orphan", lazy="joined", )