简体   繁体   English

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

[英]How to migrate models in production mode with SailsJS and MongoDB

I developed a web application with the MVC SailsJS (Version 1.1.0) framework, based on node js. 我使用基于节点js的MVC SailsJS (版本1.1.0)框架开发了一个Web应用程序。 I released it in production mode but every time I release an update from development to production I don't know how to do that. 我以生产模式发布了它,但是每次从开发到生产发布更新时,我都不知道该怎么做。

This, because in development I can execute the sails lift -alter command that independently modifies the models and adapts them to new modifications, but in production this command is blocked. 这是因为在开发中,我可以执行sails lift -alter命令,该命令独立修改模型并使模型适应新的修改,但是在生产中,此命令被阻止。

What is the best way to take? 最好的服用方法是什么? Should I create scripts in MongoDB where I manually change the collections? 我应该在MongoDB中手动更改集合的地方创建脚本吗?

As I've readed in StackOverflow and other sites including Sails official documentation you have to edit your database by hand to addapt to your new model changes given: 正如我在StackOverflow和其他站点(包括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." “所有模型的迁移设置都必须migrate: 'safe' 。这是一种故障migrate: 'safe'可以防止在部署过程中意外损坏生产数据。” from here in Sails Official Documentation. 这里起帆官方文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM