diff --git a/migrator/migrator.go b/migrator/migrator.go index 189a141f..7bdfa448 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -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 } }