Skip to content

Commit

Permalink
Ensure truncate command is executed on stage
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and ezr-ondrej committed Aug 12, 2024
1 parent f4245a6 commit c397b7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/migrate/manual/000_truncate_packages.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package manual

import (
"strings"

"github.com/redhatinsights/edge-api/config"
"github.com/redhatinsights/edge-api/pkg/db"
feature "github.com/redhatinsights/edge-api/unleash/features"
log "github.com/sirupsen/logrus"
)

Expand All @@ -11,7 +13,7 @@ func init() {
}

func truncatePackages() error {
if feature.TruncatePackages.IsEnabled() {
if strings.Contains(config.Get().EdgeAPIBaseURL, "stage") {
log.Info("Truncating packages table ...")
if err := db.DB.Exec("TRUNCATE TABLE commit_installed_packages, installed_packages").Error; err != nil {
return err
Expand Down

0 comments on commit c397b7b

Please sign in to comment.