From bbb3b50d0a60ebf9fee2639d8bdbc3b711f9054f Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 11 Jul 2014 10:05:28 +0800 Subject: [PATCH] Don't set primary key is alrady exists --- callback_create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callback_create.go b/callback_create.go index 52858a41..47b6ef96 100644 --- a/callback_create.go +++ b/callback_create.go @@ -65,7 +65,7 @@ func Create(scope *Scope) { } } - if !scope.HasError() { + if !scope.HasError() && scope.PrimaryKeyZero() { scope.SetColumn(scope.PrimaryKey(), id) } }