Disable database migrations in Sails.js for all models

戏子无情 提交于 2019-12-21 05:07:14

问题


I'm trying to figure out how to disable automatic database migrations for Models in Sails.js.

I know you can set migrate: 'safe' in the model, but is there a way to specify this for all models?


回答1:


Actually, there is a way to do it. ORM hooks are getting defaults from sails.config.model, so all you have to do is to create config/model.js with the following content:

module.exports.model = {
  migrate: 'safe'
}

After this the migrations won't be running upon sails lift, but they will still be applied once you create a document, for example.



来源:https://stackoverflow.com/questions/21072898/disable-database-migrations-in-sails-js-for-all-models

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!