Ignore conflicts

This commit is contained in:
2026-01-05 12:17:17 +01:00
parent 8c2f6a9093
commit 30dfeef9ce

8
db.go
View File

@@ -5,6 +5,7 @@ import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
type DB interface {
@@ -39,7 +40,6 @@ func GetDB() (DB, error) {
return db, nil
}
func (db *DBWrapper) Raw(sql string, args ...any) *gorm.DB {
return db.db.Raw(sql, args...)
}
@@ -49,5 +49,7 @@ func (db *DBWrapper) DB() *gorm.DB {
}
func (db *DBWrapper) SaveKillmails(killmails []Killmail) error {
return db.db.CreateInBatches(killmails, 10).Error
}
return db.db.Session(&gorm.Session{FullSaveAssociations: true}).
Clauses(clause.OnConflict{DoNothing: true}).
CreateInBatches(killmails, 10).Error
}