mirror of https://github.com/go-gorm/gorm.git
Don't set primary key's HasDefaultValue to true (#2127)
This commit is contained in:
parent
f301f86e29
commit
cf9b85ed90
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue