mirror of https://github.com/go-gorm/gorm.git
Stabilize schema.FieldsWithDefaultDBValue's order, close #4643
This commit is contained in:
parent
ca7accdbf6
commit
5daa413f41
|
@ -222,7 +222,7 @@ func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Nam
|
||||||
schema.PrimaryFieldDBNames = append(schema.PrimaryFieldDBNames, field.DBName)
|
schema.PrimaryFieldDBNames = append(schema.PrimaryFieldDBNames, field.DBName)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, field := range schema.FieldsByDBName {
|
for _, field := range schema.Fields {
|
||||||
if field.HasDefaultValue && field.DefaultValueInterface == nil {
|
if field.HasDefaultValue && field.DefaultValueInterface == nil {
|
||||||
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue