db-migrate / db-migrate/node-db-migrate
Programmable API createDatabase arguments are overridden
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 361
- PR merge metrics
- No merged PRs in 30d
Description
## I'm submitting a...
- [X] Bug report
- [ ] Feature request
- [ ] Question
## Current behavior
Command line parameters override `createDatabase` parameters in [Programable API](https://db-migrate.readthedocs.io/en/latest/API/programable/#createdatabasedbname-callback).
```
$ DATABASE_URL=postgres://localhost/postgres node index.js
[INFO] Created database "expected"
$ DATABASE_URL=postgres://localhost/postgres node index.js unexpected
[INFO] Created database "unexpected"
```
## Expected behavior
I would expect parameters provided to `createDatabase` always override possible command line arguments.
```
$ DATABASE_URL=postgres://localhost/postgres node index.js
[INFO] Created database "expected"
$ DATABASE_URL=postgres://localhost/postgres node index.js unexpected
[INFO] Created database "expected"
```
## Minimal reproduction of the problem with instructions
```
$ cat index.js
var dbmigrate = require('db-migrate');
var dbm = dbmigrate.getInstance(true);
dbm.createDatabase('expected')
.then(function() {
process.exit(0);
});
```
## What is the motivation / use case for changing the behavior?
Using `createDatabase` through Programable API in an program that has command line args is not possible at the moment.
## Environment
db-migrate version: 0.11.1
db-migrate-pg version: 0.4.0
Additional information:
- Node version: v10.6.0
- Platform: Mac
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/61265315-programmable-api-createdatabase-arguments-are-overridden?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).
Contributor guide
Assessment
This issue has not been assessed yet.