Tag default is in conflict with tag autoincrement
This commit is contained in:
parent
cf93b16730
commit
b5c30fd18c
@ -210,6 +210,7 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
|
||||
if field := schema.PrioritizedPrimaryField; field != nil {
|
||||
switch field.GORMDataType {
|
||||
case Int, Uint:
|
||||
if _, ok := field.TagSettings["DEFAULT"]; !ok {
|
||||
if _, ok := field.TagSettings["AUTOINCREMENT"]; !ok {
|
||||
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
|
||||
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
||||
@ -220,6 +221,7 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callbacks := []string{"BeforeCreate", "AfterCreate", "BeforeUpdate", "AfterUpdate", "BeforeSave", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"}
|
||||
for _, name := range callbacks {
|
||||
|
Loading…
x
Reference in New Issue
Block a user