Migration will clean unmapped history items

This commit is contained in:
Mark McDowall 2012-07-27 23:59:11 -07:00
commit 2de4b67d1f
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,25 @@
using System;
using System.Data;
using Migrator.Framework;
using NzbDrone.Common;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20120727)]
public class Migration20120727 : NzbDroneMigration
{
protected override void MainDbUpgrade()
{
Database.ExecuteNonQuery(@"DELETE FROM History
WHERE HistoryId IN
(
SELECT History.HistoryId
FROM History
LEFT OUTER JOIN Episodes
ON History.EpisodeId = Episodes.EpisodeId
WHERE Episodes.Title is null
)");
}
}
}