@@ -485,11 +485,13 @@ func storeOrUpdateSysPlatform(tx *gorm.DB, system *models.SystemPlatform, colsTo
485485 },
486486 })
487487
488- if system .ID != 0 {
489- // update system
490- err := txi .Select (colsToUpdate ).Updates (system ).Error
491- return base .WrapFatalDBError (err , "unable to update system_platform" )
492- }
488+ /*
489+ if system.ID != 0 {
490+ // update system
491+ err := txi.Select(colsToUpdate).Updates(system).Error
492+ return base.WrapFatalDBError(err, "unable to update system_platform")
493+ }
494+ */
493495 inventoryRecord := models.SystemInventory {
494496 ID : system .ID ,
495497 InventoryID : system .InventoryID ,
@@ -514,7 +516,7 @@ func storeOrUpdateSysPlatform(tx *gorm.DB, system *models.SystemPlatform, colsTo
514516 return col == "template_id"
515517 })
516518 err := database .OnConflictUpdateMulti (txi , []string {"rh_account_id" , "inventory_id" }, inventoryColsToUpdate ... ).
517- Save (& inventoryRecord ).Error
519+ Create (& inventoryRecord ).Error
518520 if err != nil {
519521 return base .WrapFatalDBError (err , "unable to insert to system_inventory" )
520522 }
@@ -524,15 +526,16 @@ func storeOrUpdateSysPlatform(tx *gorm.DB, system *models.SystemPlatform, colsTo
524526 system .RhAccountID = inventoryRecord .RhAccountID
525527 system .UnchangedSince = inventoryRecord .UnchangedSince
526528
527- var patchColsToUpdate []string
529+ // var patchColsToUpdate = []string{"last_evaluation"}
530+ var patchColsToUpdate = []string {}
528531 if slices .Contains (colsToUpdate , "template_id" ) {
529- patchColsToUpdate = [] string { "template_id" }
532+ patchColsToUpdate = append ( patchColsToUpdate , "template_id" )
530533 }
531534 patchRecord := models.SystemPatch {
532- SystemID : inventoryRecord .ID ,
533- RhAccountID : system .RhAccountID ,
534- LastEvaluation : system .LastEvaluation ,
535- TemplateID : system .TemplateID ,
535+ SystemID : inventoryRecord .ID ,
536+ RhAccountID : system .RhAccountID ,
537+ // LastEvaluation: system.LastEvaluation,
538+ TemplateID : system .TemplateID ,
536539 }
537540 txp := tx .Clauses (clause.Returning {Columns : []clause.Column {{Name : "last_evaluation" }}})
538541 err = database .OnConflictUpdateMulti (txp , []string {"rh_account_id" , "system_id" }, patchColsToUpdate ... ).
0 commit comments