cli icon indicating copy to clipboard operation
cli copied to clipboard

Support Multiple databases create cli

Open Melona-BS opened this issue 2 years ago • 1 comments

What you are doing?

<config.js>

module.exports = {
  "development": {
    "databases": {
      "database1": {
        ...
        "dialect": "mysql"
      },
      "database2": {
        ...
        "dialect": "mysql"
      }
    }
  }
}

What do you expect to happen?

I want to input "sequelize db:create" in terminal

Loaded configuration file "config\config.js".
Using environment "development".
Database **database1, database2** created.

What is actually happening?

Just print Error message!!! example...

ERROR: Dialect undefined does not support db:create / db:drop commands

I want "databases" set in config.js to be applied to create.

I know that read databases based on config.js and setting models in sequelize. But cli doesn't work to create "databases" that setted within config.js. Is there any way to do this(Create "databases" using cli or any other way)?

Dialect: mysql Database version: Ver 8.0.28 for Win64 on x86_64 Sequelize CLI version: ^6.4.1 Sequelize version: ^6.19.0

Melona-BS avatar Jan 18 '23 08:01 Melona-BS

As far as I know the CLI does not support multiple databases. PRs from the community slowly adding support for multiple databases is welcome.

For now something you can do is just set up the first database, update the config to the second database and run the same commands on the second database.

WikiRik avatar Jan 18 '23 12:01 WikiRik