mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
46c2e0ba82
Co-Authored-By: Qstick <376117+Qstick@users.noreply.github.com> Co-authored-by: ta264 <ta264@users.noreply.github.com> (cherry picked from commit 80b1aa9a2c81617bdda7ef551c19a2f114e49204)
29 lines
944 B
C#
29 lines
944 B
C#
using Dapper;
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
{
|
|
public class CleanupOrphanedPendingReleases : IHousekeepingTask
|
|
{
|
|
private readonly IMainDatabase _database;
|
|
|
|
public CleanupOrphanedPendingReleases(IMainDatabase database)
|
|
{
|
|
_database = database;
|
|
}
|
|
|
|
public void Clean()
|
|
{
|
|
using (var mapper = _database.OpenConnection())
|
|
{
|
|
mapper.Execute(@"DELETE FROM ""PendingReleases""
|
|
WHERE ""Id"" IN (
|
|
SELECT ""PendingReleases"".""Id"" FROM ""PendingReleases""
|
|
LEFT OUTER JOIN ""Authors""
|
|
ON ""PendingReleases"".""AuthorId"" = ""Authors"".""Id""
|
|
WHERE ""Authors"".""Id"" IS NULL)");
|
|
}
|
|
}
|
|
}
|
|
}
|