如何使用 SailsJS 和 MongoDB 在生产模式下迁移模型

How to migrate models in production mode with SailsJS and MongoDB

我使用 MVC SailsJS (版本 1.1.0) 框架开发了一个基于节点 js 的 Web 应用程序。我在生产模式下发布了它,但每次我发布从开发到生产的更新时,我都不知道该怎么做。

这是因为在开发中我可以执行 sails lift -alter 命令来独立修改模型并使它们适应新的修改,但在生产中这个命令被阻止了。

最好的服用方法是什么?我应该在手动更改集合的 MongoDB 中创建脚本吗?

正如我在 Whosebug 和其他网站(包括 Sails 官方文档)中所读到的,您必须手动编辑数据库以适应给定的新模型更改:

"All of your models' migration settings are forced to migrate: 'safe'. This is a failsafe to protect against inadvertently damaging your production data during deployment." 来自 Sails 官方文档中的 here