Fixed: PG Issues on CleanupOrphanedTrackFiles Housekeeper

pull/3295/head
Qstick 2 years ago
parent 83d618e0b7
commit 250a70328e

@ -13,6 +13,12 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
}
public void Clean()
{
CleanupOrphanedByAlbum();
CleanupOrphanedByTracks();
}
private void CleanupOrphanedByAlbum()
{
using (var mapper = _database.OpenConnection())
{
@ -24,7 +30,13 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
LEFT OUTER JOIN ""Tracks""
ON ""TrackFiles"".""Id"" = ""Tracks"".""TrackFileId""
WHERE ""Tracks"".""Id"" IS NULL)");
}
}
private void CleanupOrphanedByTracks()
{
using (var mapper = _database.OpenConnection())
{
// Unlink Tracks where the Trackfiles entry no longer exists
mapper.Execute(@"UPDATE ""Tracks""
SET ""TrackFileId"" = 0

Loading…
Cancel
Save