[#6372] Fixed nullable constraint bug for columns during auto migration
This commit is contained in:
parent
deceebfab8
commit
b870cfc93b
@ -525,7 +525,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
||||
// check nullable
|
||||
if nullable, ok := columnType.Nullable(); ok && nullable == field.NotNull {
|
||||
// not primary key & database is nullable
|
||||
if !field.PrimaryKey && nullable {
|
||||
if !field.PrimaryKey && !nullable {
|
||||
alterColumn = true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user