mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Starting to add ALTER COLUMN to SQLite.
This commit is contained in:
parent
50ee2ee357
commit
1c5a74df98
6 changed files with 151 additions and 4 deletions
49
NzbDrone.Core.Test/Datastore/SQLiteAlterFixture.cs
Normal file
49
NzbDrone.Core.Test/Datastore/SQLiteAlterFixture.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
{
|
||||
[TestFixture]
|
||||
public class SQLiteAlterFixture : DbTest
|
||||
{
|
||||
private SQLiteAlter Subject;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
var connection = Mocker.Resolve<IDatabase>().DataMapper.ConnectionString;
|
||||
Subject = new SQLiteAlter(connection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_parse_existing_columns()
|
||||
{
|
||||
var columns = Subject.GetColumns("Series");
|
||||
|
||||
columns.Should().NotBeEmpty();
|
||||
|
||||
columns.Values.Should().NotContain(c => string.IsNullOrWhiteSpace(c.Name));
|
||||
columns.Values.Should().NotContain(c => string.IsNullOrWhiteSpace(c.Schema));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_create_table_from_column_list()
|
||||
{
|
||||
var columns = Subject.GetColumns("Series");
|
||||
columns.Remove("Title");
|
||||
|
||||
Subject.CreateTable("Series_New", columns.Values);
|
||||
|
||||
var newColumns = Subject.GetColumns("Series_New");
|
||||
|
||||
newColumns.Values.Should().HaveSameCount(columns.Values);
|
||||
newColumns.Should().NotContainKey("Title");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue