mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Synchronization code
This commit is contained in:
parent
d435b21326
commit
f13fba5f66
@ -408,6 +408,7 @@ namespace SqlSugar
|
||||
dbColumns.Any(dc => dc.DbColumnName.EqualCase(ec.DbColumnName)
|
||||
&& ((ec.Length != dc.Length && !UtilMethods.GetUnderType(ec.PropertyInfo).IsEnum() && UtilMethods.GetUnderType(ec.PropertyInfo).IsIn(UtilConstants.StringType)) ||
|
||||
ec.IsNullable != dc.IsNullable ||
|
||||
IsNoSamePrecision(ec, dc) ||
|
||||
IsNoSamgeType(ec, dc)))).ToList();
|
||||
var renameColumns = entityColumns
|
||||
.Where(it => !string.IsNullOrEmpty(it.OldDbColumnName))
|
||||
@ -500,6 +501,15 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsNoSamePrecision(EntityColumnInfo ec, DbColumnInfo dc)
|
||||
{
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.EnableCodeFirstUpdatePrecision == true)
|
||||
{
|
||||
return ec.DecimalDigits != dc.DecimalDigits && ec.UnderType.IsIn(UtilConstants.DobType,UtilConstants.DecType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void KeyAction(EntityColumnInfo item, DbColumnInfo dbColumn, out bool pkDiff, out bool idEntityDiff)
|
||||
{
|
||||
pkDiff = item.IsPrimarykey != dbColumn.IsPrimarykey;
|
||||
|
@ -25,5 +25,6 @@ namespace SqlSugar
|
||||
public bool IsAutoDeleteQueryFilter { get; set; }
|
||||
public bool EnableModelFuncMappingColumn { get; set; }
|
||||
public bool EnableOracleIdentity { get; set; }
|
||||
public bool EnableCodeFirstUpdatePrecision { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,8 @@ namespace SqlSugar
|
||||
IsAutoUpdateQueryFilter = it.MoreSettings.IsAutoUpdateQueryFilter,
|
||||
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn,
|
||||
EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity,
|
||||
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery
|
||||
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery,
|
||||
EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision
|
||||
|
||||
},
|
||||
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle
|
||||
|
Loading…
Reference in New Issue
Block a user