[#6372] Fixed nullable constraint bug for columns during auto migration

This commit is contained in:
홍성욱 2024-11-07 16:40:49 +09:00
parent deceebfab8
commit b870cfc93b

View File

@ -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
}
}