|
|
|
@ -13,8 +13,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
|
|
|
|
|
|
|
|
public void Clean()
|
|
|
|
|
{
|
|
|
|
|
CleanupOrphanedBySeries();
|
|
|
|
|
CleanupOrphanedByEpisode();
|
|
|
|
|
//CleanupOrphanedBySeries();
|
|
|
|
|
//CleanupOrphanedByEpisode();
|
|
|
|
|
CleanupOrphanedByMovie();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CleanupOrphanedBySeries()
|
|
|
|
@ -29,6 +30,18 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
|
|
|
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();
|
|
|
|
|