From 0df272ead81a43960b5b4e0ab70bd2f48ac1a679 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Mon, 21 Aug 2023 13:20:43 +0200 Subject: [PATCH] Describe contract --- cmd/internal/database/postgres/upgrade.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/internal/database/postgres/upgrade.go b/cmd/internal/database/postgres/upgrade.go index 4a1cd1d..aa6365b 100644 --- a/cmd/internal/database/postgres/upgrade.go +++ b/cmd/internal/database/postgres/upgrade.go @@ -23,7 +23,9 @@ const ( oldPostgresBindir = "/usr/local/bin/pg-old" ) -// Upgrade indicates whether the database files are from a previous version of and need to be upgraded +// Upgrade indicates whether the database files are from a previous version of and need to be upgraded. +// If any preconditions are not met, no error is returned, a info log entry is created with the reason. +// Once the upgrade was made, any error condition will require to recover the database from backup. func (db *Postgres) Upgrade() error { start := time.Now() // First check if there are data already present @@ -141,12 +143,6 @@ func (db *Postgres) Upgrade() error { return fmt.Errorf("unable to detect bindir of actual postgres %w", err) } - // pg_upgrade \ - // --old-datadir /data/postgres \ - // --new-datadir /data/postgres-new \ - // --old-bindir /usr/local/bin/pg-old \ - // --new-bindir /usr/local/bin \ - // --link pgUpgradeArgs := []string{ "--old-datadir", db.datadir, "--new-datadir", newDataDirTemp,