Tag default is in conflict with tag autoincrement
This commit is contained in:
parent
cf93b16730
commit
b5c30fd18c
@ -210,13 +210,15 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
|
|||||||
if field := schema.PrioritizedPrimaryField; field != nil {
|
if field := schema.PrioritizedPrimaryField; field != nil {
|
||||||
switch field.GORMDataType {
|
switch field.GORMDataType {
|
||||||
case Int, Uint:
|
case Int, Uint:
|
||||||
if _, ok := field.TagSettings["AUTOINCREMENT"]; !ok {
|
if _, ok := field.TagSettings["DEFAULT"]; !ok {
|
||||||
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
|
if _, ok := field.TagSettings["AUTOINCREMENT"]; !ok {
|
||||||
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
|
||||||
}
|
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
||||||
|
}
|
||||||
|
|
||||||
field.HasDefaultValue = true
|
field.HasDefaultValue = true
|
||||||
field.AutoIncrement = true
|
field.AutoIncrement = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user