在针对MSSQL的Sequelize-cli迁移上将加密设置为true

时间:2019-05-13 13:22:34

标签: javascript sql-server sequelize.js

我正在尝试运行sequelize-cli,特别是npx sequelize db:migrate

我已经在config/config.js中创建了一个配置文件,看起来像这样(显然具有正确的凭据):

module.exports = {
  development: {
    username: "USER",
    password: "PASSWORD",
    database: "DB_NAME",
    host: "HOST.net",
    dialect: 'mssql',
    dialectOptions: {
      encrypt: "true" // bool - true - doesn't work either
    }
  }
};

但是我收到以下错误:

ERROR: Server requires encryption, set 'encrypt' config option to true.

正如您从我的配置中看到的那样,我相信我已将crypto设置为true。这就是我对如何从the docs设置此选项的理解。

如何成功将encrypt设置为true?

1 个答案:

答案 0 :(得分:2)

这应该可以解决问题,

module.exports = {
  development: {
    username: "USER",
    password: "PASSWORD",
    database: "DB_NAME",
    host: "HOST.net",
    dialect: 'mssql',
    dialectOptions: { 
      options: {
        encrypt: true
      }
    }
  } 
};