mirror of https://github.com/go-gorm/gorm.git
Fixed creation of associated records with composite primary keys (go-gorm#3817) (#3818)
This commit is contained in:
parent
51568ba4ab
commit
f2321ca164
|
@ -318,13 +318,9 @@ func onConflictOption(stmt *gorm.Statement, s *schema.Schema, selectColumns map[
|
|||
|
||||
if len(defaultUpdatingColumns) > 0 {
|
||||
var columns []clause.Column
|
||||
if s.PrioritizedPrimaryField != nil {
|
||||
columns = []clause.Column{{Name: s.PrioritizedPrimaryField.DBName}}
|
||||
} else {
|
||||
for _, dbName := range s.PrimaryFieldDBNames {
|
||||
columns = append(columns, clause.Column{Name: dbName})
|
||||
}
|
||||
}
|
||||
|
||||
return clause.OnConflict{
|
||||
Columns: columns,
|
||||
|
|
Loading…
Reference in New Issue