mirror of https://github.com/go-gorm/gorm.git
Don't set auto increment primary key's HasDefaultValue to true
This commit is contained in:
parent
294eb58fc2
commit
8f0f5df8c6
|
@ -175,7 +175,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
|
||||||
field.HasDefaultValue = true
|
field.HasDefaultValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
|
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok && !field.IsPrimaryKey {
|
||||||
field.HasDefaultValue = true
|
field.HasDefaultValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue