From 122b07ff773bcdbbe80c71ce3a4343cd523ac830 Mon Sep 17 00:00:00 2001 From: Gerrit Date: Wed, 23 Aug 2023 12:42:02 +0200 Subject: [PATCH] Fix. --- cmd/internal/database/postgres/upgrade.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/internal/database/postgres/upgrade.go b/cmd/internal/database/postgres/upgrade.go index 0c1714a..d4f063e 100644 --- a/cmd/internal/database/postgres/upgrade.go +++ b/cmd/internal/database/postgres/upgrade.go @@ -271,13 +271,6 @@ func (db *Postgres) copyPostgresBinaries(override bool) error { return err } - if !override { - if _, err := os.Stat(path.Join(binDir, postgresConfigCmd)); err == nil { - db.log.Info("postgres binaries for later upgrade already in place, not copying") - return nil - } - } - version, err := db.getBinaryVersion(postgresConfigCmd) if err != nil { return err @@ -285,6 +278,13 @@ func (db *Postgres) copyPostgresBinaries(override bool) error { pgBinDir := path.Join(db.datadir, fmt.Sprintf("%s%d", postgresBinBackupPrefix, version)) + if !override { + if _, err := os.Stat(path.Join(pgBinDir, postgresConfigCmd)); err == nil { + db.log.Info("postgres binaries for later upgrade already in place, not copying") + return nil + } + } + err = os.RemoveAll(pgBinDir) if err != nil { return fmt.Errorf("unable to remove old pg bin dir: %w", err)