From 85ba776e65e8083321373555ab1a3ab020372e79 Mon Sep 17 00:00:00 2001 From: Hylke Visser Date: Wed, 10 Oct 2018 14:46:13 +0200 Subject: [PATCH] Don't set primary key's HasDefaultValue to true --- model_struct.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model_struct.go b/model_struct.go index 8c27e209..2413aadc 100644 --- a/model_struct.go +++ b/model_struct.go @@ -189,7 +189,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 }