Fixed: SeriesBookLink housekeeping task

pull/1032/head
ta264 4 years ago
parent be09385c9d
commit bfb42929a2

@ -16,18 +16,18 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
using (var mapper = _database.OpenConnection()) using (var mapper = _database.OpenConnection())
{ {
mapper.Execute(@"DELETE FROM SeriesBookLinks mapper.Execute(@"DELETE FROM SeriesBookLink
WHERE Id IN ( WHERE Id IN (
SELECT SeriesBookLinks.Id FROM SeriesBookLinks SELECT SeriesBookLink.Id FROM SeriesBookLink
LEFT OUTER JOIN Books LEFT OUTER JOIN Books
ON SeriesBookLinks.BookId = Books.Id ON SeriesBookLink.BookId = Books.Id
WHERE Books.Id IS NULL)"); WHERE Books.Id IS NULL)");
mapper.Execute(@"DELETE FROM SeriesBookLinks mapper.Execute(@"DELETE FROM SeriesBookLink
WHERE Id IN ( WHERE Id IN (
SELECT SeriesBookLinks.Id FROM SeriesBookLinks SELECT SeriesBookLink.Id FROM SeriesBookLink
LEFT OUTER JOIN Series LEFT OUTER JOIN Series
ON SeriesBookLinks.SeriesId = Series.Id ON SeriesBookLink.SeriesId = Series.Id
WHERE Series.Id IS NULL)"); WHERE Series.Id IS NULL)");
} }
} }

Loading…
Cancel
Save