Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(pg:promote): pg:promote returns early and does not promote when no database name DATABASE exists. #3002

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

justinwilaby
Copy link
Contributor

@justinwilaby justinwilaby commented Sep 3, 2024

This PR fixes a regression defect caused by an early return statement. When no current database was found, the entire command would return causing the database to not be promoted and no message given to the user.

To Test

  1. Checkout this branch and build
  2. Add 2 Heroku PG databases and then delete the first one. (this is a shortcut to remove the DATABASE attachment
  3. Confirm no DATABSE attachment exists
  4. execute the command bin/run pg:promote <postgresql_databse_name> -a <app_name>
  5. Verify the output includes pg:promote succeeded.

tickets
W-16645361
W-16615296

@justinwilaby justinwilaby requested a review from a team as a code owner September 3, 2024 15:51
@justinwilaby justinwilaby enabled auto-merge (squash) September 3, 2024 19:51
Copy link
Contributor

@eablack eablack left a comment

Choose a reason for hiding this comment

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

Hmm. I'm not 100% sure we're replicating the correct behavior. The "early return when it can't find DATABASE" logic was in place in 8.5.11 (https://github.com/heroku/cli/blob/v8.11.5/packages/pg-v5/commands/promote.js) and has been in place for a long time (as far back as 7.69.1 -- https://github.com/heroku/cli/blob/v7.69.1/packages/pg-v5/commands/promote.js). I'm not sure we're supposed to be creating a new database attachment when DATABASE doesn't exist. Can you check with the data team about the correct behavior here?

@justinwilaby justinwilaby merged commit 39b4d08 into main Sep 3, 2024
8 checks passed
@justinwilaby justinwilaby deleted the fix/pg-promote branch September 3, 2024 22:40
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.

2 participants