Fix onConflict with non-updatable in associations

This commit is contained in:
zkqiang 2021-08-23 01:35:32 +08:00 committed by Jinzhu
parent f21e35f7c5
commit e81833fd11
1 changed files with 1 additions and 1 deletions

View File

@ -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
}