Merge branch 'master' into master

This commit is contained in:
Jinzhu 2019-10-17 23:43:05 +08:00 committed by GitHub
commit 9ed1469547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -103,10 +103,10 @@ func (s *mysql) DataTypeOf(field *StructField) string {
precision = fmt.Sprintf("(%s)", p) precision = fmt.Sprintf("(%s)", p)
} }
if _, ok := field.TagSettingsGet("NOT NULL"); ok || field.IsPrimaryKey { if _, ok := field.TagSettings["NOT NULL"]; ok || field.IsPrimaryKey {
sqlType = fmt.Sprintf("timestamp%v", precision) sqlType = fmt.Sprintf("DATETIME%v", precision)
} else { } else {
sqlType = fmt.Sprintf("timestamp%v NULL", precision) sqlType = fmt.Sprintf("DATETIME%v NULL", precision)
} }
} }
default: default:

View File

@ -225,7 +225,7 @@ func (scope *Scope) SetColumn(column interface{}, value interface{}) error {
updateAttrs[field.DBName] = value updateAttrs[field.DBName] = value
return field.Set(value) return field.Set(value)
} }
if (field.DBName == dbName) || (field.Name == name && mostMatchedField == nil) { if !field.IsIgnored && ((field.DBName == dbName) || (field.Name == name && mostMatchedField == nil)) {
mostMatchedField = field mostMatchedField = field
} }
} }