From 4e7722a849a1489e39c033f670d18a4f861879c0 Mon Sep 17 00:00:00 2001 From: Lukas Zapletal Date: Mon, 12 Aug 2024 14:39:21 +0200 Subject: [PATCH] Ensure truncate command is executed on stage --- cmd/migrate/manual/000_truncate_packages.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/migrate/manual/000_truncate_packages.go b/cmd/migrate/manual/000_truncate_packages.go index bbc4cbf63..dd2ed084f 100644 --- a/cmd/migrate/manual/000_truncate_packages.go +++ b/cmd/migrate/manual/000_truncate_packages.go @@ -1,17 +1,19 @@ 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" ) func init() { - registerMigration("truncate packages if enabled (000)", truncatePackages) + //registerMigration("truncate packages if enabled (000)", truncatePackages) } 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