forked from mirror/gorm
OnConflict UpdateAll includes fields that specified default values via tag
This commit is contained in:
parent
9b8d3b3a0f
commit
60b769c2c8
|
@ -337,7 +337,7 @@ func ConvertToCreateValues(stmt *gorm.Statement) (values clause.Values) {
|
|||
columns := make([]string, 0, len(values.Columns)-1)
|
||||
for _, column := range values.Columns {
|
||||
if field := stmt.Schema.LookUpField(column.Name); field != nil {
|
||||
if !field.PrimaryKey && !field.HasDefaultValue && field.AutoCreateTime == 0 {
|
||||
if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil) && field.AutoCreateTime == 0 {
|
||||
columns = append(columns, column.Name)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue