From 72c44aebbeec3a83ed97ea25a3262174d744df65 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 20 Apr 2022 15:28:22 +0300 Subject: [PATCH] fix: automatically set nullzero when there is default:value option --- schema/table.go | 1 + 1 file changed, 1 insertion(+) diff --git a/schema/table.go b/schema/table.go index 1a8393fc7..e39cefb30 100644 --- a/schema/table.go +++ b/schema/table.go @@ -374,6 +374,7 @@ func (t *Table) newField(f reflect.StructField, prefix string, index []int) *Fie } if s, ok := tag.Option("default"); ok { field.SQLDefault = s + field.NullZero = true } if s, ok := field.Tag.Option("type"); ok { field.UserSQLType = s