Fixed creation of associated records with composite primary keys (go-gorm#3817) (#3818)

This commit is contained in:
Andrei Baibaratsky 2020-12-03 08:00:26 +01:00 committed by GitHub
parent 51568ba4ab
commit f2321ca164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

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