Disable database migrations in Sails.js for all mo

2019-03-30 02:19发布

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?

标签: sails.js
1条回答
倾城 Initia
2楼-- · 2019-03-30 02:58

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.

查看更多
登录 后发表回答