mirror of
https://github.com/fergalmoran/Readarr.git
synced 2025-12-22 09:29:59 +00:00
* New: Store all releases for an album and track artists * Add Overview, links and release date by release * Tidy up * Fix metadata refresh errors following musicbrainz edits
27 lines
822 B
C#
27 lines
822 B
C#
using NzbDrone.Core.Datastore;
|
|
|
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
{
|
|
public class CleanupOrphanedReleases : IHousekeepingTask
|
|
{
|
|
private readonly IMainDatabase _database;
|
|
|
|
public CleanupOrphanedReleases(IMainDatabase database)
|
|
{
|
|
_database = database;
|
|
}
|
|
|
|
public void Clean()
|
|
{
|
|
var mapper = _database.GetDataMapper();
|
|
|
|
mapper.ExecuteNonQuery(@"DELETE FROM AlbumReleases
|
|
WHERE Id IN (
|
|
SELECT AlbumReleases.Id FROM AlbumReleases
|
|
LEFT OUTER JOIN Albums
|
|
ON AlbumReleases.AlbumId = Albums.Id
|
|
WHERE Albums.Id IS NULL)");
|
|
}
|
|
}
|
|
}
|