Upgrade Postgres
The Postgres project supports each major version for a fixed period, so a long-lived database eventually needs a major upgrade. Orchard runs the upgrade for you: it can rehearse on a copy first, takes a checkpoint, and puts the database back on the previous version if the upgrade fails. The database is offline during the upgrade step.
Minor releases contain bug and security fixes only. To apply one, select Update to <version> on the database’s Security tab, or run orchard db update <dbId>. Instances restart one at a time, standbys first. To have Orchard apply minor releases for you, an organization admin turns on Apply minor updates automatically under Organization settings > Database defaults. Orchard then updates a few databases each morning (UTC). An operator can turn automatic updates off for the whole instance.
Prerequisites
Section titled “Prerequisites”- Edit access to the project: the Admin or Member project role.
- A dedicated database that is running and healthy.
- No other restore or upgrade running on the database.
Check the running version
Section titled “Check the running version”- Open the database.
- Go to Security.
The Version and security card shows the running version and its support date. It also lists known vulnerabilities from postgresql.org.
To read the running version and known vulnerabilities, run the following command:
orchard db security <dbId>To list the versions that this instance offers, run the following command:
orchard db versionsUpgrade to a new major version
Section titled “Upgrade to a new major version”- Open the database.
- Go to Security.
- Select Upgrade to Postgres
<version>. The button shows the newest version. - In To, select the target version.
- Keep Rehearse on a copy first turned on. This adds a few minutes before the upgrade.
- Select Upgrade to Postgres
<version>.
To follow the upgrade, go to the Backups tab.
orchard db upgrade <dbId> --to 18 --waitTo skip the rehearsal, add --no-rehearse. To change how long --wait blocks, use --timeout. The default is 10 minutes.
How an upgrade runs
Section titled “How an upgrade runs”- If rehearsal is on, Orchard upgrades a copy of the database to check that the upgrade works.
- Orchard takes a checkpoint.
- Orchard upgrades the database. The database is offline during this step.
- Orchard runs
ANALYZE. - If backup storage is set, Orchard starts a new backup.
If the upgrade fails, Orchard returns the database to the previous version.
If a previous rehearsal measured the upgrade time, the upgrade dialog shows that time as the expected offline period.
Respond to a support warning
Section titled “Respond to a support warning”Version and security shows a warning when support for the running major version ends soon, and an error after support ends. After that date, the major version receives no more security fixes.
To resolve the warning or the error, upgrade to a newer major version.
Related resources
Section titled “Related resources”- Back up and restore a database - Restore to a checkpoint if you need to undo an upgrade later.
orchard db upgradereference - Review the upgrade flags, including--no-rehearseand--timeout.