From 595fd8fac95be706988382c06ba9b6502e580a67 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 15 Nov 2022 17:50:02 +0800 Subject: [PATCH 1/2] refact(database): add omit Associations for UpsertModelsOnUniqueID --- database/model.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/database/model.go b/database/model.go index 5a8d3f6..bf8aa27 100644 --- a/database/model.go +++ b/database/model.go @@ -271,11 +271,13 @@ func UpsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, } result := db.Model(mdl). - //Debug(). + Debug(). + //Omit(clause.Associations). Clauses(clause.OnConflict{ Columns: []clause.Column{{Name: uniqueName}}, DoUpdates: clause.AssignmentColumns(fieldsToUpdate), - }).Create(models) + }). + Create(models) return result.Error } From 2cca2a9e030944f31486dd80f44183f501d55fdd Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 15 Nov 2022 17:50:05 +0800 Subject: [PATCH 2/2] refact(database): add omit Associations for UpsertModelsOnUniqueID --- database/model.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/model.go b/database/model.go index bf8aa27..9af3131 100644 --- a/database/model.go +++ b/database/model.go @@ -271,8 +271,8 @@ func UpsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, } result := db.Model(mdl). - Debug(). - //Omit(clause.Associations). + //Debug(). + Omit(clause.Associations). Clauses(clause.OnConflict{ Columns: []clause.Column{{Name: uniqueName}}, DoUpdates: clause.AssignmentColumns(fieldsToUpdate),