Skip to content

Conversation

@briceamen
Copy link
Contributor

Summary

  • add database NG plan upgrade command
  • implement plan change wait logic and upgrade flow
  • update command registration and changelog

Testing

  • manual: created dbng and upgraded plan on staging

@notion-workspace
Copy link

@briceamen briceamen requested a review from Copilot January 13, 2026 08:08
@briceamen briceamen self-assigned this Jan 13, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new command to upgrade database next generation (DBNG) plans, including support for waiting until the upgrade completes.

Changes:

  • Added database-upgrade command with plan change logic and optional wait functionality
  • Integrated the new command into the CLI command registry
  • Updated cross-references to include the new command in related database commands

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
dbng/upgrade.go Implements the core upgrade logic with plan validation, addon upgrade API call, and wait functionality for plan changes
cmd/databases_ng.go Adds the database-upgrade command definition with argument parsing and integrates it into SeeAlso references
cmd/commands.go Registers the new database-upgrade command in the global command list
CHANGELOG.md Documents the new database plan upgrade command feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@matthieu526-scalingo matthieu526-scalingo left a comment

Choose a reason for hiding this comment

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

Good job! Two small comments.

Copy link
Member

@curzolapierre curzolapierre left a comment

Choose a reason for hiding this comment

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

Some questions otherwise LGTM

Comment on lines +158 to +159
io.Error("Invalid number of arguments")
return cli.ShowCommandHelp(ctx, c, "database-upgrade")
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: generally with no argument given we just print the help WDYT?

Otherwise, could you share an example of the output either here in comment or in PR's body?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, it should behave like database-create and just print the help when no args are provided. I’ll align with that.

For the output, here’s a sample from staging:

$ scalingo database-upgrade 69652796697f13aac6687e51 postgresql-ng-enterprise-8192
Your postgresql-ng database 69652796697f13aac6687e51 ('ng-plan-change-xxx') is being upgraded…

With --wait, it shows the spinner then:
Your database plan change is complete.

Comment on lines 147 to 153
if c.IsSet("database") || os.Getenv("SCALINGO_DATABASE") != "" {
databaseID, _ = detect.GetCurrentDatabase(ctx, c)
plan = args[0]
} else {
io.Error("Missing required argument: plan")
return cli.ShowCommandHelp(ctx, c, "database-upgrade")
}
Copy link
Member

Choose a reason for hiding this comment

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

Question: is this still working when we pass --database as first argument?

IIRC is it what is usually expected for application flag:

scalingo --database MY-DB-ID database-upgrade postgresql-ng-enterprise-8192

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that’s the expected usage:
scalingo --database MY-DB-ID database-upgrade postgresql-ng-enterprise-8192
It work since the flag is global.

return err
}

if db.Database.Status == scalingo.DatabaseStatusRunning {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion I'd also check the plan. IIRC API still accept the request without error even if the requested plan is the same as the current one.
So in that specific case it'd hang forever.


var dbAddon *scalingo.Addon
if db.Database.ResourceID != "" {
if len(addons) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I am not sure this optimization is needed. The loop is probably not expensive.

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