无法使用 Sailsjs 适配器连接 aws rds

Unable to connect aws rds using Sailsjs adapters

我可以从 mysql CLI 访问我的 aws rds mysql 实例。但是相同的配置不适用于 sailsjs 数据库适配器。

这是我的./config/env/production.js

connections: {
    mysqlServer: {
      host: "demo.c4a1v1iyi4x1.ap-southeast-1.rds.amazonaws.com",
      user: "username",
      password: "password",
      database: "mydb",
    },
  }, 

我修改了我的 ./config/models.js 来创建表格

/**
 * Default model configuration
 * (sails.config.models)
 *
 * Unless you override them, the following properties will be included
 * in each of your models.
 *
 * For more info on Sails models, see:
 * http://sailsjs.org/#/documentation/concepts/ORM
 */

module.exports.models = {

  /***************************************************************************
  *                                                                          *
  * Your app's default connection. i.e. the name of one of your app's        *
  * connections (see `config/connections.js`)                                *
  *                                                                          *
  ***************************************************************************/
  connection: 'mysqlServer',

  /***************************************************************************
  *                                                                          *
  * How and whether Sails will attempt to automatically rebuild the          *
  * tables/collections/etc. in your schema.                                  *
  *                                                                          *
  * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
  *                                                                          *
  * In a production environment (NODE_ENV==="production") Sails always uses  *
  * migrate:"safe" to protect inadvertent deletion of your data.             *
  * However development has a few other options for convenience:             *
  *                                                                          *
  * safe - never auto-migrate my database(s). I will do it myself (by hand)  *
  * alter - auto-migrate, but attempt to keep existing data (experimental)   *
  * drop - wipe/drop ALL my data and rebuild models every time I lift Sails  *
  *                                                                          *
  ***************************************************************************/
  migrate: 'alter',

};

使用上述配置,sails.js 无法在 aws rds 中连接或创建表 instance.Can 谁能帮我解决这个问题。提前致谢。

知道错了。 Sails.Js 在生产环境中强制水线使用 'migrate:safe' 而不是 'alter' 或 'drop'。因此,任何 table 创作都被禁止了。因此,我使用 'migrate:alter' 和 运行 sails lift 用生产覆盖开发配置。答对了!所有表格均已创建。

Sails 能够与 rds 连接,但它自己的配置不允许它创建 table。