Skip to content

feat(database-ng) add support database flag to dbng commands - #1153

Merged
curzolapierre merged 5 commits into
masterfrom
feat/STORY-2513/add_database_flag_to_dbng
Oct 6, 2025
Merged

curzolapierre merged 5 commits into
masterfrom
feat/STORY-2513/add_database_flag_to_dbng

Conversation

@curzolapierre

@curzolapierre curzolapierre commented Oct 2, 2025 •

Copy link
Copy Markdown
Member
  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

With --app and a database ID

➜ scalingo database-info --app $DATABASE_ID
 !     No database found. Please use --database flag.

With the correct --database flag

➜ scalingo database-info --database $DATABASE_ID
┌────────────────────────┬───────────────────────────────┐
│ ID                     │ 68c43e3cd9985668949c5ffa      │
...

With a database name

➜ scalingo apps-info --database $DATABASE
 !     It is currently impossible to use `apps-info` on a database.

The generated help

➜ scalingo database-info --help
NAME:
   scalingo database-info - View database next generation

USAGE:
   scalingo database-info database-id

CATEGORY:
   Databases NG

DESCRIPTION:
   View database next generation detailed informations

   Examples
     $ scalingo database-info database_id
     $ scalingo database-info --database database_id

   # See also 'databases' 'database-create' 'database-destroy'

OPTIONS:
   --database string  ID of the current database (default: "<database_name>")
   --region string    Name of the region to use
   --help, -h         show help

Also fixes STORY-2587

@curzolapierre curzolapierre self-assigned this Oct 2, 2025
@notion-workspace

Copy link
Copy Markdown

@curzolapierre
curzolapierre marked this pull request as ready for review October 3, 2025 07:33
@curzolapierre
curzolapierre force-pushed the feat/STORY-2513/add_database_flag_to_dbng branch from 4b3af30 to 9007193 Compare October 3, 2025 07:43
Comment thread utils/consent.go

for _, db := range dbs {
if db.App.Name == resourceName {
if db.App.Name == resourceName || db.App.ID == resourceName {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here both check are needed because:

  • the database ID is used for all scalingo database* commands.
  • the database name is used for all others (like what we do with apps).

@curzolapierre
curzolapierre force-pushed the feat/STORY-2513/add_database_flag_to_dbng branch from 9007193 to 8865a70 Compare October 3, 2025 10:05
@curzolapierre
curzolapierre force-pushed the feat/STORY-2513/add_database_flag_to_dbng branch from cf65a0c to 3a53979 Compare October 3, 2025 10:14
@notion-workspace

Copy link
Copy Markdown

Comment thread cmd/databases_ng.go
Comment on lines +46 to +47
"scalingo database-info database_id",
"scalingo database-info --database database_id",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking: I don't remember if this was in the specs, but when seeing this I wonder if this is a good idea to allow both options.

@curzolapierre curzolapierre Oct 3, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As talked during last PSM, we want to use this PR as support for this topic precisely. So your comment is welcome 👍

To answer, IMO we could keep both.
The usage of flags (i.e. --database here) was not in the specs, but they are easier to use and that's currently how we do for other commands.

e.g. equivalent command for apps:

scalingo apps-info --app <app_name>

If we had to choose one, I would go with the use of flags (--database). But I'll let @leo-scalingo give his opinion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also prefer using flags than arguments, for this precise command, since the database_id is the subject I'm ok to keep both as syntax sugar

Comment thread cmd/databases_ng.go Resolved
Comment thread cmd/databases_ng.go
Examples: []string{
"scalingo database-create --type postgresql --plan postgresql-dbng-starter-2048 my_super_database",
"scalingo database-create --type postgresql --plan postgresql-dbng-starter-2048 --wait my_super_database",
"scalingo database-create --type postgresql-ng --plan postgresql-ng-enterprise-4096 my_super_database",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: I don't think the type is different, is it?

Suggested change
"scalingo database-create --type postgresql-ng --plan postgresql-ng-enterprise-4096 my_super_database",
"scalingo database-create --type postgresql --plan postgresql-ng-enterprise-4096 my_super_database",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is since the first deployment of given plans. We now distinguish between the two.
Note: there were a conflict of credentials (cf: STORY-2622)

Comment thread detect/app.go Resolved

@briceamen briceamen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@leo-scalingo leo-scalingo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread cmd/databases_ng.go
Comment on lines +46 to +47
"scalingo database-info database_id",
"scalingo database-info --database database_id",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also prefer using flags than arguments, for this precise command, since the database_id is the subject I'm ok to keep both as syntax sugar

@curzolapierre
curzolapierre force-pushed the feat/STORY-2513/add_database_flag_to_dbng branch from a481deb to a1cb464 Compare October 6, 2025 10:02
@curzolapierre
curzolapierre merged commit 2c3fcdb into master Oct 6, 2025
6 checks passed
@curzolapierre
curzolapierre deleted the feat/STORY-2513/add_database_flag_to_dbng branch October 6, 2025 10:02
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