1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-22 07:42:28 +00:00

Fixed: Correct typing for ImportListExclusions tvdbid column

(cherry picked from commit af8c67a24d343ba4640400886ee940d5be5ce55f)
This commit is contained in:
Qstick 2023-06-27 21:07:08 -05:00 committed by servarr
parent c88cf5fed4
commit 22636bb762
2 changed files with 55 additions and 0 deletions

View file

@ -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<import_exclusion_type>
{
[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<ImportListExclusions192>("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; }
}
}

View file

@ -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();
}
}
}