Skip to content

Commit

Permalink
fix: delete the movie relation before deleting the mediaitem (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptrplan authored Oct 13, 2024
1 parent 943433c commit 5bfe63a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/program/db/db_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def delete_media_item_by_id(media_item_id: int, batch_size: int = 30):
delete_seasons_and_episodes(session, media_item_id, batch_size)
session.execute(delete(Show).where(Show._id == media_item_id))

if media_item_type == "movie":
session.execute(delete(Movie).where(Movie._id == media_item_id))

session.execute(delete(MediaItem).where(MediaItem._id == media_item_id))
session.commit()
return True
Expand Down

0 comments on commit 5bfe63a

Please sign in to comment.