You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
868 B
27 lines
868 B
6 years ago
|
using NzbDrone.Core.Datastore;
|
||
|
|
||
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||
|
{
|
||
|
public class CleanupOrphanedImportListStatus : IHousekeepingTask
|
||
|
{
|
||
|
private readonly IMainDatabase _database;
|
||
|
|
||
|
public CleanupOrphanedImportListStatus(IMainDatabase database)
|
||
|
{
|
||
|
_database = database;
|
||
|
}
|
||
|
|
||
|
public void Clean()
|
||
|
{
|
||
|
var mapper = _database.GetDataMapper();
|
||
|
|
||
|
mapper.ExecuteNonQuery(@"DELETE FROM ImportListStatus
|
||
|
WHERE Id IN (
|
||
|
SELECT ImportListStatus.Id FROM ImportListStatus
|
||
|
LEFT OUTER JOIN ImportLists
|
||
|
ON ImportListStatus.ProviderId = ImportLists.Id
|
||
|
WHERE ImportLists.Id IS NULL)");
|
||
|
}
|
||
|
}
|
||
|
}
|