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 committed Aug 12, 2024
1 parent f4245a6 commit 4e7722a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/migrate/manual/000_truncate_packages.go
Original file line number Diff line number Diff line change
@@ -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)

Check failure on line 12 in cmd/migrate/manual/000_truncate_packages.go

View workflow job for this annotation

GitHub Actions / Lint

commentFormatting: put a space between `//` and comment text (gocritic)
}

func truncatePackages() error {

Check failure on line 15 in cmd/migrate/manual/000_truncate_packages.go

View workflow job for this annotation

GitHub Actions / Lint

func `truncatePackages` is unused (unused)
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 4e7722a

Please sign in to comment.