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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With