mirror of
https://github.com/Radarr/Radarr
synced 2026-01-10 17:48:43 +01:00
Fix history items getting deleted because they do not have a series id.
This commit is contained in:
parent
ca03f21b03
commit
4b559cf29c
1 changed files with 15 additions and 2 deletions
|
|
@ -13,8 +13,9 @@ public CleanupOrphanedHistoryItems(IMainDatabase database)
|
|||
|
||||
public void Clean()
|
||||
{
|
||||
CleanupOrphanedBySeries();
|
||||
CleanupOrphanedByEpisode();
|
||||
//CleanupOrphanedBySeries();
|
||||
//CleanupOrphanedByEpisode();
|
||||
CleanupOrphanedByMovie();
|
||||
}
|
||||
|
||||
private void CleanupOrphanedBySeries()
|
||||
|
|
@ -29,6 +30,18 @@ LEFT OUTER JOIN Series
|
|||
WHERE Series.Id IS NULL)");
|
||||
}
|
||||
|
||||
private void CleanupOrphanedByMovie()
|
||||
{
|
||||
var mapper = _database.GetDataMapper();
|
||||
|
||||
mapper.ExecuteNonQuery(@"DELETE FROM History
|
||||
WHERE Id IN (
|
||||
SELECT History.Id FROM History
|
||||
LEFT OUTER JOIN Movies
|
||||
ON History.MovieId = Movies.Id
|
||||
WHERE Movies.Id IS NULL)");
|
||||
}
|
||||
|
||||
private void CleanupOrphanedByEpisode()
|
||||
{
|
||||
var mapper = _database.GetDataMapper();
|
||||
|
|
|
|||
Loading…
Reference in a new issue