diff --git a/controllers/indexerController.go b/controllers/indexerController.go index 1adc480..323e48c 100644 --- a/controllers/indexerController.go +++ b/controllers/indexerController.go @@ -83,6 +83,13 @@ func SaveIndexingResult(c *gin.Context) { return } + // get all files for this addon and delete them - old version + ret = initializers.DB.Where("addon_id = ?", addon.ID).Delete(&models.AddonFile{}) + if ret.Error != nil { + c.JSON(500, gin.H{"error": ret.Error.Error()}) + return + } + ret = initializers.DB.CreateInBatches(&result.Files, 100) if ret.Error != nil { c.JSON(500, gin.H{"error": ret.Error.Error()})