如果新字段是非空,但是没有默认值,那么强制改为允许空。解决数据库表升级时,在原有表中新增非空有默认值字段时,不能自动正确生成相关sql语句的问题。
This commit is contained in:
parent
5afc017bf1
commit
7c442f0f05
|
@ -237,7 +237,9 @@ internal partial class DbMetaData
|
|||
//return String.Empty;
|
||||
|
||||
// 非空字段作为可空字段新增,避开重建表
|
||||
item.Nullable = true;
|
||||
// 如果新字段是非空,但是没有默认值,那么强制改为允许空
|
||||
if (item.DefaultValue == null)
|
||||
item.Nullable = true;
|
||||
}
|
||||
|
||||
PerformSchema(sb, @readonly, DDLSchema.AddColumn, item);
|
||||
|
|
Loading…
Reference in New Issue