db-migrate / db-migrate/node-db-migrate
db:create should bypass the 'database' option
- 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
My `database.json` file:
```database.json
{
"dev": {
"driver": "mysql",
"user": "root",
"password": "root",
"database": "some_database_that_doesnt_exist_yet"
}
}
```
The command:
`db-migrate db:create some_database_that_doesnt_exist_yet`
The result:
```
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: ER_BAD_DB_ERROR: Unknown database 'some_database_that_doesnt_exist_yet'
...
```
## Expected behavior
Create the db even if the database option exists, esp. because I tend to create the db that's mentioned in `database.json`.
## Minimal reproduction of the problem with instructions
See current behavior.
## What is the motivation / use case for changing the behavior?
I write the database name that I plan to use, 'my_db', in the config. I run `db-migrate db:create my_db`. It errors. I cut the database option out. I rerun the `db-migrate db:create my_db` command. It creates the db. I paste the database option back in. It works.
The middle two steps shouldn't be necessary, because no database-specific queries are involved. It should just create the db.
## Environment
db-migrate version: 0.11.11
plugins with versions: ?
db-migrate driver with versions: db-migrate-mysql@2.1.1
Additional information:
- Node version: v12.16.3
- Platform: Windows, Bash
Others:
Contributor guide
Assessment
This issue has not been assessed yet.