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 44d3060254
commit ac78f05986
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
}