Make PostgreSQL 14 as the default version
What does this merge request do and why?
This MR restores a previously reverted MR: !3263 (merged), which was reverted due to Cannot upgrade PostgreSQL version via gdk update (#1960 - closed). Now that the issue has been resolved, we're ready to make PostgreSQL version 14 as the default version.
Related to #1831 (closed)
How to set up and validate locally
git checkout 1831-upgrade-to-postgresql-14
gdk config set gitlab.default_branch "nh/upgrade-to-postgresql-14" && gdk reconfigure
- Comment out the
GDK.make('self-update')
like this to avoid pulling the latestmain
branch when testing this branch.diff --git a/lib/gdk/command/update.rb b/lib/gdk/command/update.rb index 90c61e28..ab52bf24 100644 --- a/lib/gdk/command/update.rb +++ b/lib/gdk/command/update.rb @@ -23,8 +23,9 @@ module GDK def update! GDK::Hooks.with_hooks(config.gdk.update_hooks, 'gdk update') do - GDK.make('self-update') - GDK.make('self-update', 'update', env: { 'PG_AUTO_UPDATE' => '1' }) + # GDK.make('self-update') + # GDK.make('self-update', 'update', env: { 'PG_AUTO_UPDATE' => '1' }) + GDK.make('update', env: { 'PG_AUTO_UPDATE' => '1' }) end end
gdk update
The upgrade to PostgreSQL 14 and DB migration should be successful.
Click to expand an expected output
WARNING: PostgreSQL data directory is version 13 and must be upgraded to version 14.9 before GDK can be updated.
WARNING: PostgreSQL will be auto-updated in 10 seconds. Hit CTRL-C to abort.
Available PostgreSQL versions: {14=>"/Users/naohashizume/.asdf/installs/postgres/14.9/bin", 13=>"/Users/naohashizume/.asdf/installs/postgres/13.12/bin", 12=>"/Users/naohashizume/.asdf/installs/postgres/12.13/bin"}
Initializing '/Users/naohashizume/src/gdks/gdk10/postgresql/data.14.1695770854' for PostgreSQL 14..
Renaming /Users/naohashizume/src/gdks/gdk10/postgresql/data to /Users/naohashizume/src/gdks/gdk10/postgresql/data.13.1695770855
Upgrading '/Users/naohashizume/src/gdks/gdk10/postgresql/data.13.1695770855' (PostgreSQL 13) to '/Users/naohashizume/src/gdks/gdk10/postgresql/data.14.1695770854' PostgreSQL 14..
Promoting newly-creating database from '/Users/naohashizume/src/gdks/gdk10/postgresql/data.14.1695770854' to '/Users/naohashizume/src/gdks/gdk10/postgresql/data'
Running 'gdk reconfigure'..
WARNING: We're about to remove the old 'replica' database data because we will be replacing it with the primary database data.
Removing the old secondary database data...
Copying data from primary to secondary...
Upgraded '/Users/naohashizume/src/gdks/gdk10/postgresql/data' from PostgreSQL 13 to 14.
Successfully ran 'support/upgrade-postgresql' script!
(Optional): If you enabled PostgreSQL replica (you can check using gdk config get postgresql.replica.enabled
), the secondary database will also be automatically upgraded, and the postgresql-replica
service should not have any errors.
Click to expand an expected output
⚠️ WARNING: We're about to remove the old 'replica' database data because we will be replacing it with the primary database data.
Are you sure? [y/N]: y
ℹ️ Removing the old secondary database data...
ℹ️ Copying data from primary to secondary...
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Edited by Nao Hashizume