mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-19 21:46:50 -04:00
re-adding indexes for series/episodes.
This commit is contained in:
+22
-5
@@ -7,17 +7,17 @@ using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
namespace NzbDrone.Core.Test.Datastore.SQLiteMigrationHelperTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SQLiteMigrationHelperFixture : DbTest
|
||||
public class AlterFixture : DbTest
|
||||
{
|
||||
private SQLiteMigrationHelper _subject;
|
||||
private SqLiteMigrationHelper _subject;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_subject = Mocker.Resolve<SQLiteMigrationHelper>();
|
||||
_subject = Mocker.Resolve<SqLiteMigrationHelper>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.Datastore
|
||||
var columns = _subject.GetColumns("Series");
|
||||
columns.Remove("Title");
|
||||
|
||||
_subject.CreateTable("Series_New", columns.Values, new List<SQLiteMigrationHelper.SQLiteIndex>());
|
||||
_subject.CreateTable("Series_New", columns.Values, new List<SQLiteIndex>());
|
||||
|
||||
var newColumns = _subject.GetColumns("Series_New");
|
||||
|
||||
@@ -106,5 +106,22 @@ namespace NzbDrone.Core.Test.Datastore
|
||||
newIndexes.Should().HaveSameCount(indexes);
|
||||
newIndexes.Select(c=>c.Column).Should().BeEquivalentTo(indexes.Select(c=>c.Column));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_create_table_with_new_indexes()
|
||||
{
|
||||
var columns = _subject.GetColumns("Series");
|
||||
columns.Remove("Title");
|
||||
|
||||
_subject.CreateTable("Series_New", columns.Values, new List<SQLiteIndex>{new SQLiteIndex{Column = "AirTime", Table = "Series_New", Unique = true}});
|
||||
|
||||
var newColumns = _subject.GetColumns("Series_New");
|
||||
var newIndexes = _subject.GetIndexes("Series_New");
|
||||
|
||||
newColumns.Values.Should().HaveSameCount(columns.Values);
|
||||
newIndexes.Should().Contain(i=>i.Column == "AirTime");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore.SQLiteMigrationHelperTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class DuplicateFixture : DbTest
|
||||
{
|
||||
private SqLiteMigrationHelper _subject;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_subject = Mocker.Resolve<SqLiteMigrationHelper>();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void get_duplicates()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(10)
|
||||
.Random(3)
|
||||
.With(c => c.QualityProfileId = 100)
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(series);
|
||||
|
||||
var duplicates = _subject.GetDuplicates<int>("series", "QualityProfileId").ToList();
|
||||
|
||||
|
||||
duplicates.Should().HaveCount(1);
|
||||
duplicates.First().Should().HaveCount(3);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user