forked from mirror/gorm
Don't set primary key's HasDefaultValue to true (#2127)
This commit is contained in:
parent
44d3060254
commit
ac78f05986
|
@ -202,7 +202,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
|
||||||
modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field)
|
modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := field.TagSettingsGet("DEFAULT"); ok {
|
if _, ok := field.TagSettingsGet("DEFAULT"); ok && !field.IsPrimaryKey {
|
||||||
field.HasDefaultValue = true
|
field.HasDefaultValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue