【发布时间】:2016-02-19 08:41:18
【问题描述】:
我正在使用sails 0.11.2 版。以下是
的代码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 = {
connection: 'mysqldb',
migrate: 'safe',
schema : true
};
按照 documentation 的说法, migrate: 'safe' 应该停止自动迁移,并且不会更改数据库中的任何列或表。
但每次评论任何模型的属性并尝试提升sails应用程序时,与该属性关联的列都会从mysql数据库中删除。
注意:如果您需要任何其他信息或示例代码,请发表评论,以防查询。
【问题讨论】:
-
你能给我们看一下config/models.js的所有代码吗?你用的是哪个版本的风帆?
-
@piscator 我已经用 config/models.js 的完整文件和sails 版本更新了这个问题。
-
尝试将架构选项移动到您使用的每个模型中,架构:true,连接:'mysqldb',表名:'yourTable',属性:{}