diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/192_import_exclusion_typeFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/192_import_exclusion_typeFixture.cs new file mode 100644 index 000000000..19729798b --- /dev/null +++ b/src/NzbDrone.Core.Test/Datastore/Migration/192_import_exclusion_typeFixture.cs @@ -0,0 +1,41 @@ +using System.Linq; +using Dapper; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Datastore.Migration; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.Datastore.Migration +{ + [TestFixture] + public class import_exclusion_typeFixture : MigrationTest + { + [Test] + public void should_alter_tvdbid_column() + { + var db = WithDapperMigrationTestDb(c => + { + c.Insert.IntoTable("ImportListExclusions").Row(new + { + TvdbId = "1", + Title = "Some Series" + }); + }); + + // Should be able to insert as int after migration + db.Execute("INSERT INTO ImportListExclusions (TvdbId, Title) VALUES (2, 'Some Other Series')"); + + var exclusions = db.Query("SELECT * FROM ImportListExclusions"); + + exclusions.Should().HaveCount(2); + exclusions.First().TvdbId.Should().Be(1); + } + } + + public class ImportListExclusions192 + { + public int Id { get; set; } + public int TvdbId { get; set; } + public string Title { get; set; } + } +} diff --git a/src/NzbDrone.Core/Datastore/Migration/192_import_exclusion_type.cs b/src/NzbDrone.Core/Datastore/Migration/192_import_exclusion_type.cs new file mode 100644 index 000000000..8b59ec4dc --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/192_import_exclusion_type.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(192)] + public class import_exclusion_type : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("ImportListExclusions").AlterColumn("TvdbId").AsInt32(); + } + } +}