disable avoid adding group peers multiple times

This commit is contained in:
Pascal Fischer
2025-07-04 14:17:34 +02:00
parent b329397d06
commit 7baeea3d9d

View File

@@ -15,6 +15,7 @@ import (
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
func GetColumnName(db *gorm.DB, column string) string {
@@ -456,7 +457,9 @@ func MigrateJsonToTable[T any](ctx context.Context, db *gorm.DB, columnName stri
}
for _, value := range data {
if err := tx.Create(
if err := tx.Clauses(clause.OnConflict{
DoNothing: true, // this needs to be removed when the cleanup is enabled
}).Create(
mapperFunc(row["id"].(string), value),
).Error; err != nil {
return fmt.Errorf("failed to insert id %v: %w", row["id"], err)