出现sequelize种子方言错误

zpjtge22  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(336)

我正在尝试用npm脚本为我的数据库播种。

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

我不断收到一个错误,说我必须在配置中显式定义方言。这是我的配置文件:

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

不完全确定我做错了什么/

eufgjt7s

eufgjt7s1#

必须导出配置:

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

相关问题