mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-03 09:09:42 +02:00
Fixed: SqliteSchemaDumper with separate Primary Key clause
This commit is contained in:
@@ -25,6 +25,12 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
|
|||||||
[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")]
|
[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")]
|
||||||
|
[TestCase(@"CREATE TABLE IF NOT EXISTS ""Test Table"" (
|
||||||
|
""MyId"" INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY(""MyId"" AUTOINCREMENT)
|
||||||
|
);",
|
||||||
|
"Test Table",
|
||||||
|
"MyId")]
|
||||||
public void should_parse_table_language_flavors(string sql, string tableName, string columnName)
|
public void should_parse_table_language_flavors(string sql, string tableName, string columnName)
|
||||||
{
|
{
|
||||||
var result = Subject.ReadTableSchema(sql);
|
var result = Subject.ReadTableSchema(sql);
|
||||||
|
@@ -154,12 +154,12 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
|
|||||||
{
|
{
|
||||||
var start = Index;
|
var start = Index;
|
||||||
var end = start + 1;
|
var end = start + 1;
|
||||||
while (end < Buffer.Length && (char.IsLetter(Buffer[end]) || char.IsNumber(Buffer[end]) || Buffer[end] == '_' || Buffer[end] == '('))
|
while (end < Buffer.Length && (char.IsLetter(Buffer[end]) || char.IsNumber(Buffer[end]) || Buffer[end] == '_'))
|
||||||
{
|
{
|
||||||
end++;
|
end++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end >= Buffer.Length || Buffer[end] == ',' || Buffer[end] == ')' || char.IsWhiteSpace(Buffer[end]))
|
if (end >= Buffer.Length || Buffer[end] == ',' || Buffer[end] == ')' || Buffer[end] == '(' || char.IsWhiteSpace(Buffer[end]))
|
||||||
{
|
{
|
||||||
Index = end;
|
Index = end;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user