db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Cannot create new database #648

Closed padcom closed 5 years ago

padcom commented 5 years ago

I'm submitting a...

Current behavior

I am trying to use db:create <dbname> to create a new MySQL database. When the database.json is populated with connection information with the database specified the command fails stating that the database does not exist (doh! I am trying to create it!)

$ ./node_modules/.bin/db-migrate db:create todos
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: ER_BAD_DB_ERROR: Unknown database 'todos'

Expected behavior

The database key in database.json is ignored when running db:create

Minimal reproduction of the problem with instructions

  1. Make sure the "todos" database does not exist in your MySQL database

  2. database.json

    {
    "dev": {
    "driver": "mysql",
    "host": "127.0.0.1",
    "user": "root",
    "password": "root",
    "database": "todos"
    }
    }
  3. Run

    $ db-migrate db:create todos

What is the motivation / use case for changing the behavior?

To be able to provide stable way to create and seed database for developers when they start working on the project.

Environment


db-migrate version: 0.11.6
no plugins used
db-migrate driver with versions: db-migrate-mysql 1.1.10

Additional information:
- Node version: v12.4.0
- Platform: Linux (but I assume this is not platform specific :) )


stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.