Don't set primary key's HasDefaultValue to true (#2127)

This commit is contained in:
Hylke Visser 2019-06-10 14:24:05 +02:00 committed by Jinzhu
parent f301f86e29
commit cf9b85ed90
1 changed files with 1 additions and 1 deletions

View File

@ -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
}