From dbeeb49cafd89a5584be9723405ac19eb85d5190 Mon Sep 17 00:00:00 2001 From: Constantine Date: Mon, 27 Feb 2017 16:36:27 -0600 Subject: [PATCH 1/2] Update Column.cs to support RowGuidCol Ran into an edge case and noticed my definition would fail to create. --- model/Models/Column.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/Models/Column.cs b/model/Models/Column.cs index ce0d1126..a4391dd6 100644 --- a/model/Models/Column.cs +++ b/model/Models/Column.cs @@ -57,7 +57,7 @@ public string IdentityText { } } - public string RowGuidColText => IsRowGuidCol ? "ROWGUIDCOL" : string.Empty; + public string RowGuidColText => IsRowGuidCol ? " ROWGUIDCOL " : string.Empty; public ColumnDiff Compare(Column c) { return new ColumnDiff(this, c); @@ -98,7 +98,7 @@ private string ScriptBase(bool includeDefaultConstraint) { val.Append($" {IsNullableText}"); if (includeDefaultConstraint) val.Append(DefaultText); if (Identity != null) val.Append(IdentityText); - if (IsRowGuidCol) val.Append(@" {RowGuidColText}"); + if (IsRowGuidCol) val.Append(RowGuidColText); return val.ToString(); case "binary": From ec739311a1804164bf4639e29c36271502dc57be Mon Sep 17 00:00:00 2001 From: Constantine Date: Mon, 27 Feb 2017 16:46:09 -0600 Subject: [PATCH 2/2] Update DbHelper.cs to allow reserved keywords --- model/DBHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/DBHelper.cs b/model/DBHelper.cs index a5c6b050..7a522b62 100644 --- a/model/DBHelper.cs +++ b/model/DBHelper.cs @@ -63,13 +63,13 @@ public static void CreateDb(string connection, string databaseFilesPath = null) if (databaseFilesPath != null) { Directory.CreateDirectory(databaseFilesPath); files = $@"ON -(NAME = {dbName}, +(NAME = '{dbName}', FILENAME = '{databaseFilesPath}\{dbName + Guid.NewGuid()}.mdf') LOG ON -(NAME = {dbName}_log, +(NAME = '{dbName}_log', FILENAME = '{databaseFilesPath}\{dbName + Guid.NewGuid()}.ldf')"; } - ExecSql(cnBuilder.ToString(), "CREATE DATABASE [" + dbName + "]" + files); + ExecSql(cnBuilder.ToString(), "CREATE DATABASE [" + dbName + "] " + files); } public static bool DbExists(string conn) {