diff --git a/src/NzbDrone.Core/Datastore/Migration/120_update_series_episodes_history_indexes.cs b/src/NzbDrone.Core/Datastore/Migration/120_update_series_episodes_history_indexes.cs new file mode 100644 index 000000000..e2363a836 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/120_update_series_episodes_history_indexes.cs @@ -0,0 +1,24 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(120)] + public class update_series_episodes_history_indexes : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Create.Index().OnTable("Series").OnColumn("TvdbId").Ascending(); + Create.Index().OnTable("Episodes").OnColumn("SeriesId").Ascending() + .OnColumn("AirDate").Ascending(); + + Delete.Index().OnTable("History").OnColumn("EpisodeId"); + Create.Index().OnTable("History").OnColumn("EpisodeId").Ascending() + .OnColumn("Date").Descending(); + + Delete.Index().OnTable("History").OnColumn("DownloadId"); + Create.Index().OnTable("History").OnColumn("DownloadId").Ascending() + .OnColumn("Date").Descending(); + } + } +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index aa3eb8e8f..789aa01ca 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -224,6 +224,7 @@ +