Dialect is parsed from url, not config setting, when running db:drop
What you are doing?
Dialect specified in configuration is ignored when using a connection URL and invoking db:drop or db:create.
I have a configuration which specifies urls using postgresql:// (I believe Sequelize expects this to be postgres://, but nevertheless this feels like unexpected behavior)
This only causes trouble for me when I run db:create or db:drop
config.js
module.exports = {
development: {
url: 'postgresql://alerts:alerts@localhost/alerts',
dialect: 'postgres',
define: {
underscored: true,
},
},
test: {
url: 'postgresql://alerts:alerts@localhost/alerts',
dialect: 'postgres',
define: {
underscored: true,
},
},
production: {
url: 'postgresql://alerts:alerts@localhost/alerts',
dialect: 'postgres',
define: {
underscored: true,
},
},
}
shell command
npx sequelize-cli db:drop
Outputs:
ERROR: Dialect postgresql does not support db:create / db:drop commands
What do you expect to happen?
I expected the postgres dialect to be used, as specified in config.
What is actually happening?
It appears that the dialect is instead parsed from the query url, causing the error.
Dialect: postgres Database version: 10.12 Sequelize CLI version: 5.5.1 Sequelize version: 5.21.13
It seems that in https://github.com/sequelize/cli/pull/461 behaviour was changed in the config-helper to get the dialect from the URL instead of the config. @papb maybe something to keep in mind for the overhaul?