Skip to content

Commit

Permalink
Fix onConflict with non-updatable in associations
Browse files Browse the repository at this point in the history
  • Loading branch information
zkqiang authored and jinzhu committed Aug 26, 2021
1 parent f21e35f commit e81833f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion callbacks/associations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e81833f

Please sign in to comment.