Skip to content

Commit

Permalink
RHINENG-2284: updated evaluation to store data in {system_package,pac…
Browse files Browse the repository at this point in the history
…kage_system}_data tables
  • Loading branch information
MichaelMraka committed Nov 27, 2023
1 parent 11c6fb3 commit 59cf47d
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 176 deletions.
2 changes: 1 addition & 1 deletion base/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func OnConflictUpdateMulti(db *gorm.DB, keys []string, updateCols ...string) *go

type UpExpr struct {
Name string
Expr string
Expr interface{}
}

func OnConflictDoUpdateExpr(db *gorm.DB, keys []string, updateExprs ...UpExpr) *gorm.DB {
Expand Down
28 changes: 27 additions & 1 deletion base/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ type SystemPackage struct {
NameID int64
}

type SystemPackageData struct {
RhAccountID int `gorm:"primaryKey"`
SystemID int64 `gorm:"primaryKey"`
UpdateData []byte
}

func (SystemPackageData) TableName() string {
return "system_package_data"
}

type PackageSystemData struct {
RhAccountID int `gorm:"primaryKey"`
PackageNameID int64 `gorm:"primaryKey"`
UpdateData []byte
}

func (PackageSystemData) TableName() string {
return "package_system_data"
}

type PackageUpdate struct {
EVRA string `json:"evra"`
Advisory string `json:"-"` // don't show it in API, we can probably remove it completely later
Expand All @@ -131,9 +151,15 @@ type PackageUpdate struct {
type PackageUpdateData struct {
Installed string `json:"installed,omitempty"`
Installable string `json:"installable,omitempty"`
Applicable string `'json:"applicable,omitempty"`
Applicable string `json:"applicable,omitempty"`
}

// for a given system holds map[package_id]->update_data_json
type SystemPackageUpdateData map[int64]PackageUpdateData

// for given package_name holds map[system_id]->update_data_json
type PackageSystemUpdateData map[int64]PackageUpdateData

type DeletedSystem struct {
InventoryID string
WhenDeleted time.Time
Expand Down
Loading

0 comments on commit 59cf47d

Please sign in to comment.