delete old version files

This commit is contained in:
Sotirios Pupakis
2025-09-08 03:52:22 +02:00
parent 64d9f51f19
commit 9421fa34a8

View File

@@ -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()})