Don't set primary key is alrady exists

This commit is contained in:
Jinzhu 2014-07-11 10:05:28 +08:00
parent bdaecff30d
commit bbb3b50d0a
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ func Create(scope *Scope) {
}
}
if !scope.HasError() {
if !scope.HasError() && scope.PrimaryKeyZero() {
scope.SetColumn(scope.PrimaryKey(), id)
}
}