From b870cfc93b90f999547e1a285dc81d098837caf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=84=B1=EC=9A=B1?= Date: Thu, 7 Nov 2024 16:40:49 +0900 Subject: [PATCH] [#6372] Fixed nullable constraint bug for columns during auto migration --- migrator/migrator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } }