Issue with Sequelize seeding Dialect error

时间:2018-10-24 11:23:49

标签: mysql sequelize.js seed sequelize-cli dialect

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 个答案:

答案 0 :(得分:0)

您必须导出配置:

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"
 }
}