Fix AutoMigrate, alterColumn
The previous modifications were ignored
This commit is contained in:
parent
9ca84b3dde
commit
68e45f1c2c
@ -531,7 +531,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
||||
}
|
||||
|
||||
// check default value
|
||||
if !field.PrimaryKey {
|
||||
if !alterColumn && !field.PrimaryKey {
|
||||
currentDefaultNotNull := field.HasDefaultValue && (field.DefaultValueInterface != nil || !strings.EqualFold(field.DefaultValue, "NULL"))
|
||||
dv, dvNotNull := columnType.DefaultValue()
|
||||
if dvNotNull && !currentDefaultNotNull {
|
||||
|
Loading…
x
Reference in New Issue
Block a user