0

I'm trying to seed my database with an npm script.

  "scripts": {
    "devstart": "set NODE_ENV=development && sequelize db:seed:all && nodemon ./server.js"
  }

I keep getting an error saying that I have to explicitly define the dialect in my config. This is my config file:

{
 "development": {
    "use_env_variable": "LOCALDB",
    "dialect": "mysql"
 },
 "test": {
    "username": "root",
    "password": null,
    "database": "database_test",
    "host": "127.0.0.1",
    "dialect": "mysql"
 },
 "production": {
    "use_env_variable": "JAWSDB_URL",
    "dialect": "mysql"
 }
}

Not entirely sure what I am doing wrong. :/

1 Answers1

0

You must export your configuration:

module.exports = {
 "development": {
    "use_env_variable": "LOCALDB",
    "dialect": "mysql"
 },
 "test": {
    "username": "root",
    "password": null,
    "database": "database_test",
    "host": "127.0.0.1",
    "dialect": "mysql"
 },
 "production": {
    "use_env_variable": "JAWSDB_URL",
    "dialect": "mysql"
 }
}
mcranston18
  • 4,680
  • 3
  • 36
  • 37
  • my mistake. On my projects, mine is an exported `.js` file, but I forgot config file can be JSON. Could you also post the file where you initialize Sequelize and pass in the DB config? – mcranston18 Oct 25 '18 at 15:16