From cf9b85ed90acf96933b70e8bae0e4dc28a0f9687 Mon Sep 17 00:00:00 2001 From: Hylke Visser Date: Mon, 10 Jun 2019 14:24:05 +0200 Subject: [PATCH] Don't set primary key's HasDefaultValue to true (#2127) --- model_struct.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model_struct.go b/model_struct.go index bfab49c0..5234b287 100644 --- a/model_struct.go +++ b/model_struct.go @@ -202,7 +202,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct { modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field) } - if _, ok := field.TagSettingsGet("DEFAULT"); ok { + if _, ok := field.TagSettingsGet("DEFAULT"); ok && !field.IsPrimaryKey { field.HasDefaultValue = true }