mirror of https://github.com/go-gorm/gorm.git
Allow customize AutoIncrement for primary field
This commit is contained in:
parent
30188e7aa4
commit
e1084e78d0
|
@ -187,8 +187,11 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
|
||||||
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
|
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
|
||||||
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
||||||
}
|
}
|
||||||
field.HasDefaultValue = true
|
|
||||||
field.AutoIncrement = true
|
if _, ok := field.TagSettings["AUTOINCREMENT"]; !ok {
|
||||||
|
field.HasDefaultValue = true
|
||||||
|
field.AutoIncrement = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue