fix broken migration abstraction, fixes restart after upgrade so the runtimestate is correct, fixes sql alter column migration to actually run if its nullable.

This commit is contained in:
Shannon
2021-06-24 13:35:57 -06:00
parent d6a6016801
commit 3d5d04550a
95 changed files with 271 additions and 263 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
@@ -357,7 +357,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.SqlSyntax
sql.Append(" ");
sql.Append(FormatIdentity(column));
var isNullable = column.IsNullable;
//var isNullable = column.IsNullable;
//var constraint = FormatConstraint(column)?.TrimStart("CONSTRAINT ");
//var hasConstraint = !string.IsNullOrWhiteSpace(constraint);
@@ -365,11 +365,14 @@ namespace Umbraco.Cms.Infrastructure.Persistence.SqlSyntax
//var defaultValue = FormatDefaultValue(column);
//var hasDefaultValue = !string.IsNullOrWhiteSpace(defaultValue);
if (isNullable /*&& !hasConstraint && !hasDefaultValue*/)
{
sqls = Enumerable.Empty<string>();
return sql.ToString();
}
// TODO: This used to exit if nullable but that means this would never work
// to return SQL if the column was nullable?!? I don't get it. This was here
// 4 years ago, I've removed it so that this works for nullable columns.
//if (isNullable /*&& !hasConstraint && !hasDefaultValue*/)
//{
// sqls = Enumerable.Empty<string>();
// return sql.ToString();
//}
var msql = new List<string>();
sqls = msql;