From e81833fd112370be5cf3268d6919d8a4cda1d46a Mon Sep 17 00:00:00 2001 From: zkqiang Date: Mon, 23 Aug 2021 01:35:32 +0800 Subject: [PATCH] Fix onConflict with non-updatable in associations --- callbacks/associations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callbacks/associations.go b/callbacks/associations.go index 78f976c3..14c433c4 100644 --- a/callbacks/associations.go +++ b/callbacks/associations.go @@ -314,7 +314,7 @@ func onConflictOption(stmt *gorm.Statement, s *schema.Schema, selectColumns map[ if stmt.DB.FullSaveAssociations { defaultUpdatingColumns = make([]string, 0, len(s.DBNames)) for _, dbName := range s.DBNames { - if v, ok := selectColumns[dbName]; (ok && !v) || (!ok && restricted) { + if v, ok := selectColumns[dbName]; (ok && !v) || (!ok && restricted) || !s.FieldsByDBName[dbName].Updatable { continue }