Update create.go
This commit is contained in:
parent
bf49d4caa4
commit
a780c0264c
@ -304,7 +304,7 @@ func ConvertToCreateValues(stmt *gorm.Statement) (values clause.Values) {
|
|||||||
if field := stmt.Schema.LookUpField(column.Name); field != nil {
|
if field := stmt.Schema.LookUpField(column.Name); field != nil {
|
||||||
if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
|
if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
|
||||||
if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil ||
|
if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil ||
|
||||||
strings.ToUpper(field.DefaultValue) == "NULL") && field.AutoCreateTime == 0 {
|
strings.EqualFold(field.DefaultValue, "NULL")) && field.AutoCreateTime == 0 {
|
||||||
if field.AutoUpdateTime > 0 {
|
if field.AutoUpdateTime > 0 {
|
||||||
assignment := clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: curTime}
|
assignment := clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: curTime}
|
||||||
switch field.AutoUpdateTime {
|
switch field.AutoUpdateTime {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user