Skip to content

feat: 'data:pg:migrate' command implementation (W-21303011)#3546

Merged
sbosio merged 18 commits into
mainfrom
sbosio/ngpg-migrate
May 13, 2026
Merged

feat: 'data:pg:migrate' command implementation (W-21303011)#3546
sbosio merged 18 commits into
mainfrom
sbosio/ngpg-migrate

Conversation

@sbosio
Copy link
Copy Markdown
Contributor

@sbosio sbosio commented Feb 27, 2026

Summary

Here we implement a new data:pg:migrate interactive command that will allow customers to migrate Heroku Postgres Classic databases to the new Advanced tier.

There's some heavy refactor on this PR around (now shared) behavior between data:pg:create and the new data:pg:migrate command, given the latter needed a way to create an Advanced database as the target for a migration. Shared behavior was generalized and extracted to PoolConfig (in a similar way to what we did for data:pg:create and data:pg:update). While working on this we detected that we missed to copy the unit tests for that PoolConfig module from the NGPG plugin. We fix that here, plus add new tests for the extracted shared behavior.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

In order to test, checkout this branch, build the CLI and use the ./bin/run tool to run the command.

git checkout sbosio/ngpg-migrate
npm install && npm run build
./bin/run data:pg:migrate -a <test-app-name>

There are a few ways to configure a migration, but basically you'll need to have at least one legacy (non-Advanced) database created on your test app. Then you can use the interactive option to create a target database on-the-fly as the destination for the migration or you can have an Advanced database already created and available and select it as destination.

After the migration tooling is prepared, your migration config should be Ready for either starting or canceling the migration. When canceled, you'll need to start again the configuration and wait for preparation. If started, the migration should run until it completes.

The pair of databases (source and destination) that belong to a pending migration (any state between preparing and completed, failed or canceled) cannot be selected again as a source and destination for another migration. To test these scenarios you should have more than one legacy database on the test app to select as source.

Screenshots (if applicable)

Target selection

Captura de pantalla 2026-05-12 a la(s) 18 21 49

Migration config confirmation

Captura de pantalla 2026-05-12 a la(s) 18 22 01

Preparing migration after confirmation

Captura de pantalla 2026-05-12 a la(s) 18 22 11

Starting migration confirmation

Captura de pantalla 2026-05-12 a la(s) 18 22 52

Migration started

Captura de pantalla 2026-05-12 a la(s) 18 23 03

Related Issues

GUS work item: W-21303011

@sbosio sbosio requested a review from a team as a code owner February 27, 2026 22:21
@sbosio sbosio marked this pull request as draft February 27, 2026 22:21
@sbosio sbosio temporarily deployed to AcceptanceTests March 9, 2026 23:01 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 9, 2026 23:01 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 9, 2026 23:01 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 9, 2026 23:01 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 16:33 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 16:33 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 16:33 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 16:33 — with GitHub Actions Inactive
- Disabling create target database option (backend isn't ready).
- Adding validation that target database is available.
- Linting fixes.
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 18:56 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 18:56 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 18:56 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests March 11, 2026 18:56 — with GitHub Actions Inactive
@sbosio sbosio had a problem deploying to AcceptanceTests May 12, 2026 13:15 — with GitHub Actions Failure
@sbosio sbosio force-pushed the sbosio/ngpg-migrate branch from a16cfda to 0b2985c Compare May 12, 2026 19:40
@sbosio sbosio had a problem deploying to AcceptanceTests May 12, 2026 19:40 — with GitHub Actions Failure
@sbosio sbosio had a problem deploying to AcceptanceTests May 12, 2026 19:40 — with GitHub Actions Failure
@sbosio sbosio had a problem deploying to AcceptanceTests May 12, 2026 19:40 — with GitHub Actions Failure
@sbosio sbosio force-pushed the sbosio/ngpg-migrate branch from 0b2985c to 070f175 Compare May 12, 2026 19:49
@sbosio sbosio had a problem deploying to AcceptanceTests May 12, 2026 19:49 — with GitHub Actions Failure
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 19:49 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 19:49 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 19:49 — with GitHub Actions Inactive
@sbosio sbosio force-pushed the sbosio/ngpg-migrate branch from 070f175 to 89bf020 Compare May 12, 2026 21:10
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
@sbosio sbosio temporarily deployed to AcceptanceTests May 12, 2026 21:10 — with GitHub Actions Inactive
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/lib/data/types.ts
Comment thread src/commands/data/pg/migrate.ts Outdated
Comment thread src/lib/data/types.ts
Copy link
Copy Markdown
Contributor

@k80bowman k80bowman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great and, when I ran it through it's paces, worked perfectly.

sbosio and others added 3 commits May 13, 2026 14:59
Applying CX review feedback.

Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Santiago Bosio <santiago.bosio@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants