Sequelize: How do I use the non-dev config?

I'm reading the sequelize documentation: http://docs.sequelizejs.com/manual/tutorial/migrations.html

It has you create a config file that looks like this:

{
  development: {
    username: 'root',
    password: null,
    database: 'database_development',
    host: '127.0.0.1',
    dialect: 'mysql'
  },
  test: {
    username: 'root',
    password: null,
    database: 'database_test',
    host: '127.0.0.1',
    dialect: 'mysql'
  },
  production: {
    username: process.env.PROD_DB_USERNAME,
    password: process.env.PROD_DB_PASSWORD,
    database: process.env.PROD_DB_NAME,
    host: process.env.PROD_DB_HOSTNAME,
    dialect: 'mysql'
  }
}

And it says to run it like this: node_modules/.bin/sequelize db:migrate. It defaults to development.

But the documentation doesn't tell me how to run the test configuration or the production configuration. How do I do that?

1 answer

  • answered 2018-01-11 19:49 Daniel Kaplan

    I had to look at the source code to find this. It does this:

        return args.env || process.env.NODE_ENV || 'development';