Skip to content

Commit

Permalink
RHINENG-2281: remove system_package table from /packages/version
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMraka committed Nov 27, 2023
1 parent eb03597 commit 10e8d71
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
7 changes: 0 additions & 7 deletions base/database/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ func PackageSystemDataShort(tx *gorm.DB, accountID int) *gorm.DB {
Where("pd.rh_account_id = ?", accountID)
}

func SystemPackages(tx *gorm.DB, accountID int, groups map[string]string) *gorm.DB {
return Systems(tx, accountID, groups).
Joins("JOIN system_package spkg on spkg.system_id = sp.id AND spkg.rh_account_id = ?", accountID).
Joins("JOIN package p on p.id = spkg.package_id").
Joins("JOIN package_name pn on pn.id = spkg.name_id")
}

func SystemPackageData(tx *gorm.DB, accountID int, groups map[string]string) *gorm.DB {
return Systems(tx, accountID, groups).
Joins(`JOIN (SELECT system_id,
Expand Down
4 changes: 0 additions & 4 deletions base/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ type SystemPackage struct {
NameID int64
}

func (SystemPackage) TableName() string {
return "system_package"
}

type PackageUpdate struct {
EVRA string `json:"evra"`
Advisory string `json:"-"` // don't show it in API, we can probably remove it completely later
Expand Down
4 changes: 2 additions & 2 deletions manager/controllers/package_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func packagesNameID(db *gorm.DB, pkgName string) *gorm.DB {
}

func packageVersionsQuery(db *gorm.DB, acc int, groups map[string]string, packageNameIDs []int) *gorm.DB {
query := database.SystemPackages(db, acc, groups).
query := database.SystemPackageData(db, acc, groups).
Distinct(PackageVersionSelect).
Where("sp.stale = false").
Where("spkg.name_id in (?)", packageNameIDs)
Where("p.name_id in (?)", packageNameIDs)
return query
}

Expand Down

0 comments on commit 10e8d71

Please sign in to comment.