forked from mirror/gorm
Fix onConflict with non-updatable in associations
This commit is contained in:
parent
f21e35f7c5
commit
e81833fd11
|
@ -314,7 +314,7 @@ func onConflictOption(stmt *gorm.Statement, s *schema.Schema, selectColumns map[
|
||||||
if stmt.DB.FullSaveAssociations {
|
if stmt.DB.FullSaveAssociations {
|
||||||
defaultUpdatingColumns = make([]string, 0, len(s.DBNames))
|
defaultUpdatingColumns = make([]string, 0, len(s.DBNames))
|
||||||
for _, dbName := range 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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue