From 3276e3ec52014a4f64e5841232104a752a2cbe76 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sat, 28 Jan 2017 17:54:19 +0100 Subject: [PATCH] Fix for movies without an imdbid. Fixes 176 --- .../Migration/125_fix_imdb_unique.cs | 31 +++++++++++++++++++ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + 2 files changed, 32 insertions(+) create mode 100644 src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs diff --git a/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs b/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs new file mode 100644 index 000000000..407ad06c4 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/125_fix_imdb_unique.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; +using System.Data; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(125)] + public class fix_imdb_unique : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.WithConnection(DeleteUniqueIndex); + } + + private void DeleteUniqueIndex(IDbConnection conn, IDbTransaction tran) + { + using (IDbCommand getSeriesCmd = conn.CreateCommand()) + { + getSeriesCmd.Transaction = tran; + getSeriesCmd.CommandText = @"DROP INDEX 'IX_Movies_ImdbId'"; + + getSeriesCmd.ExecuteNonQuery(); + } + } + + } +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index d84d0401b..90af64f1a 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -183,6 +183,7 @@ +