- 优化 CodeFirst 字段变化对比逻辑

This commit is contained in:
28810
2020-05-26 02:50:21 +08:00
parent 1ac13d6327
commit 0d6ebc1e26
13 changed files with 199 additions and 185 deletions

View File

@ -353,9 +353,10 @@ namespace FreeSql.MsAccess
{
foreach (var tbcol in tb.ColumnsByPosition)
{
if (istmpatler) break;
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"NOT\s+NULL", "NULL");
if (tbstruct.TryGetValue(tbcol.Attribute.Name, out var tbstructcol) ||
string.IsNullOrEmpty(tbcol.Attribute.OldName) == false && tbstruct.TryGetValue(tbcol.Attribute.OldName, out tbstructcol))
string.IsNullOrEmpty(tbcol.Attribute.OldName) == false && tbstruct.TryGetValue(tbcol.Attribute.OldName, out tbstructcol))
{
if (tbstructcol.sqlType != "LONG" && tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
istmpatler = true;
@ -371,6 +372,9 @@ namespace FreeSql.MsAccess
//添加列
istmpatler = true;
}
}
if (istmpatler == false)
{
var dsuk = getIndexesByTableName(tbtmp);
foreach (var uk in tb.Indexes)
{