Added StringLiteral as an acceptable identifier for sqlite migrations

pull/2/head
Keivan Beigi 10 years ago
parent a8eb0f73d1
commit 78aa91c170

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
[TestCase(@"CREATE TABLE ""TestTable"" (""MyId"" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "TestTable", "MyId")]
[TestCase(@"CREATE TABLE [TestTable] ([MyId] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "TestTable", "MyId")]
[TestCase(@"CREATE TABLE `TestTable` (`MyId` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "TestTable", "MyId")]
[TestCase(@"CREATE TABLE 'Config' ('Id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'Key' TEXT NOT NULL, 'Value' TEXT NOT NULL)", "Config", "Id")]
[TestCase(@"CREATE TABLE 'TestTable' ('MyId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "TestTable", "MyId")]
[TestCase(@"CREATE TABLE ""Test """"Table"" (""My""""Id"" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "Test \"Table", "My\"Id")]
[TestCase(@"CREATE TABLE [Test Table] ([My Id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "Test Table", "My Id")]
[TestCase(@" CREATE TABLE `Test ``Table` ( `My`` Id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ) ", "Test `Table", "My` Id")]
@ -40,6 +40,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
[TestCase(@"CREATE INDEX TestIndex ON TestTable (MyId)", "TestIndex", "TestTable", "MyId")]
[TestCase(@"CREATE INDEX ""TestIndex"" ON ""TestTable"" (""MyId"" ASC)", "TestIndex", "TestTable", "MyId")]
[TestCase(@"CREATE INDEX 'TestIndex' ON 'TestTable' ('MyId' ASC)", "TestIndex", "TestTable", "MyId")]
[TestCase(@"CREATE INDEX [TestIndex] ON ""TestTable"" ([MyId] DESC)", "TestIndex", "TestTable", "MyId")]
[TestCase(@"CREATE INDEX `TestIndex` ON `TestTable` (`MyId` COLLATE abc ASC)", "TestIndex", "TestTable", "MyId")]
[TestCase(@"CREATE INDEX ""Test """"Index"" ON ""TestTable"" (""My""""Id"" ASC)", "Test \"Index", "TestTable", "My\"Id")]

@ -170,7 +170,8 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
reader.Read();
if (reader.Type != SqliteSyntaxReader.TokenType.Identifier &&
reader.Type != SqliteSyntaxReader.TokenType.StringToken)
reader.Type != SqliteSyntaxReader.TokenType.StringToken &&
reader.Type != SqliteSyntaxReader.TokenType.StringLiteral)
{
throw reader.CreateSyntaxException("Expected Identifier but found {0}", reader.Type);
}

Loading…
Cancel
Save