Skip to content

Commit

Permalink
fix(sqlite): default [development] URL to :memory: (#926)
Browse files Browse the repository at this point in the history
```sh
cds init bookshop && cd bookshop
cds env get requires.db
```
currently gives you
```js
{
  impl: '@cap-js/sqlite',
  credentials: { url: 'db.sqlite', database: ':memory:' }, 💣 "url" and "database" don't match
  kind: 'sqlite'
}
```

There are a few ways to solve this but I think `@cap-js/sqlite` should
determine itself that the default URL for `[development]` is `:memory:`,
and not rely on the default defined in `@sap/cds` (see the `_databases`
section in `cds-requires.js`), which it currently does.

This is a non-breaking change, as today the `cds`-provided `url:
':memory:'` wins, so even before we deployed to an in-memory DB by
default. This just fixes a confusing log and prepares for the next major
version, where we can then remove the redundant and outdated
`credentials.database`.
  • Loading branch information
swaldmann authored Dec 2, 2024
1 parent 0562858 commit 51e8aa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sqlite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
"kinds": {
"sql": {
"[development]": {
"kind": "sqlite"
"kind": "sqlite",
"credentials": {
"url": ":memory:"
}
}
},
"sqlite": {
Expand Down

0 comments on commit 51e8aa7

Please sign in to comment.