From a3740aec5a2ed235499d03ff1b0ca243783da512 Mon Sep 17 00:00:00 2001 From: Roy Reznik Date: Wed, 6 May 2020 00:09:30 +0300 Subject: [PATCH] Update logic --- callback_update.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/callback_update.go b/callback_update.go index 2931503e..c35e4988 100644 --- a/callback_update.go +++ b/callback_update.go @@ -75,8 +75,8 @@ func updateCallback(scope *Scope) { } else { for _, field := range scope.Fields() { if scope.changeableField(field) { - if !field.IsPrimaryKey && field.IsNormal && (field.Name != "CreatedAt" || !field.IsBlank) { - if !field.IsForeignKey && (!field.IsBlank || field.HasDefaultValue) { + if !field.IsPrimaryKey && field.IsNormal && !field.IsBlank { + if !field.IsForeignKey || !field.IsBlank || !field.HasDefaultValue { sqls = append(sqls, fmt.Sprintf("%v = %v", scope.Quote(field.DBName), scope.AddToVars(field.Field.Interface()))) } } else if relationship := field.Relationship; relationship != nil && relationship.Kind == "belongs_to" {