1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Added StringLiteral as an acceptable identifier for sqlite migrations

This commit is contained in:
Keivan Beigi 2014-12-06 11:32:42 -08:00
parent a8eb0f73d1
commit 78aa91c170
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@ public void Setup()
[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 @@ public void should_parse_table_language_flavors(String sql, String tableName, St
[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")]

View File

@ -170,7 +170,8 @@ protected virtual String ParseIdentifier(SqliteSyntaxReader reader)
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);
}