This commit is contained in:
Puskar Basu
2025-03-19 13:32:54 +05:30
parent 431d56a36e
commit 1f864220f6
4 changed files with 11 additions and 10 deletions

View File

@@ -27,12 +27,12 @@ const (
// constants for installing db and fdw images
const (
DatabaseVersion = "14.17.0"
DatabaseVersion = "14.17.0-dev.4"
FdwVersion = "1.12.4"
// PostgresImageRef is the OCI Image ref for the database binaries
PostgresImageRef = "ghcr.io/turbot/steampipe/db:14.17.0"
PostgresImageDigest = "sha256:eb5a1abc6ac3373398183bc76d03e0a1aa2f2912d4010117e87f3e0c05a1d982"
PostgresImageRef = "ghcr.io/turbot/steampipe/db:14.17.0-dev.4"
PostgresImageDigest = "sha256:899d2ec4e75226bd04c62d9a185416252a6ce5b966a5fc47d2d7b082684f51b8"
FdwImageRef = "ghcr.io/turbot/steampipe/fdw:" + FdwVersion
FdwBinaryFileName = "steampipe_postgres_fdw.so"

View File

@@ -329,7 +329,7 @@ func runRestoreUsingList(ctx context.Context, info *RunningDBInstanceInfo, listF
// connection parameters
"--host=127.0.0.1",
fmt.Sprintf("--port=%d", info.Port),
fmt.Sprintf("--username=%s", info.User),
fmt.Sprintf("--username=%s", constants.DatabaseSuperUser),
)
log.Println("[TRACE]", cmd.String())

View File

@@ -27,7 +27,7 @@ import (
var ensureMux sync.Mutex
func noBackupWarning() string {
warningMessage := `Steampipe database has been upgraded from Postgres 12 to Postgres 14.
warningMessage := `Steampipe database has been upgraded from Postgres 14.2 to Postgres 14.17.
Unfortunately the data in your public schema failed migration using the standard pg_dump and pg_restore tools. Your data has been preserved in the ~/.steampipe/db directory.
@@ -89,6 +89,7 @@ func EnsureDBInstalled(ctx context.Context) (err error) {
// NOTE: this returns the existing database name - we use this when creating the new database
dbName, err := prepareBackup(ctx)
if err != nil {
log.Printf("[ERROR] prepareBackup failed: %s", err.Error())
if errors.Is(err, errDbInstanceRunning) {
// remove the installation - otherwise, the backup won't get triggered, even if the user stops the service
os.RemoveAll(filepaths.DatabaseInstanceDir())

View File

@@ -198,6 +198,11 @@ func postServiceStart(ctx context.Context, res *StartResult) error {
return err
}
// if there is an unprocessed db backup file, restore it now
if err := restoreDBBackup(ctx); err != nil {
return sperr.WrapWithMessage(err, "failed to migrate db public schema")
}
// create the clone_foreign_schema function
if _, err := executeSqlAsRoot(ctx, cloneForeignSchemaSQL); err != nil {
return sperr.WrapWithMessage(err, "failed to create clone_foreign_schema function")
@@ -207,11 +212,6 @@ func postServiceStart(ctx context.Context, res *StartResult) error {
return sperr.WrapWithMessage(err, "failed to create clone_comments function")
}
// if there is an unprocessed db backup file, restore it now
if err := restoreDBBackup(ctx); err != nil {
return sperr.WrapWithMessage(err, "failed to migrate db public schema")
}
return nil
}