Skip to content

feat: provide postgres profile#1491

Open
patricebender wants to merge 4 commits into
mainfrom
patrice/pg
Open

feat: provide postgres profile#1491
patricebender wants to merge 4 commits into
mainfrom
patrice/pg

Conversation

@patricebender
Copy link
Copy Markdown
Member

this does the same as the already existing pg
profile. People can provide their service credentials and just do a cds deploy --profile postgres which is symmetrical to the cds deploy --profile sqlite

for #1471

this does the same as the already existing `pg`
profile. People can provide their service credentials
and just do a `cds deploy --profile postgres` which is
symmetrical to the `cds deploy --profile sqlite`
Comment thread postgres/package.json Outdated
Comment on lines +61 to +67
"credentials": {
"host": "localhost",
"port": 5432,
"user": "postgres",
"password": "postgres",
"database": "postgres"
}
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.

These credentials could be moved into the postgres kind under the [development] profile. Then both pg and postgres can just be the kind: postgres ?

@patricebender
Copy link
Copy Markdown
Member Author

do we need the !? locally it doesnt make a difference, it seems.

@patricebender patricebender marked this pull request as ready for review February 17, 2026 16:21
@patricebender patricebender requested a review from swaldmann March 2, 2026 07:55
Comment thread postgres/package.json
"kind": "postgres"
},
"[pg!]": {
"[development]": {
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.

This makes Postgres the default for all non-production scenarios though. Might be intended, but we defaulted to SQLite before so this is an incompatible change.

It's then also doing this merge of SQLite and Postgres credentials for a new project:
cds init bookshop --add sample --nodejs && cd bookshop && cds add postgres && cds env requires.db:

{
  impl: '@cap-js/sqlite',
  credentials: {
    url: ':memory:',
    host: 'localhost',
    port: 5432,
    user: 'postgres',
    password: 'postgres',
    database: 'postgres'
  },
  data: [ 'db/data', 'db/csv', 'test/data' ],
  pool: { max: 1 },
  kind: 'sqlite'
}

I propose instead you put the credentials under cds.requires.kinds.postgres, similar to how it's done in @cap-js/hana:
https://github.com/cap-js/cds-dbs/blob/main/hana/package.json#L58-L72

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.

3 participants