Stabilize schema.FieldsWithDefaultDBValue's order, close #4643

This commit is contained in:
Jinzhu 2021-11-08 20:20:55 +08:00
parent ca7accdbf6
commit 5daa413f41
1 changed files with 1 additions and 1 deletions

View File

@ -222,7 +222,7 @@ func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Nam
schema.PrimaryFieldDBNames = append(schema.PrimaryFieldDBNames, field.DBName)
}
for _, field := range schema.FieldsByDBName {
for _, field := range schema.Fields {
if field.HasDefaultValue && field.DefaultValueInterface == nil {
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
}