Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable database migrations in Sails.js for all models

Tags:

sails.js

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?

like image 487
Shaheen Ghiassy Avatar asked Jan 12 '14 08:01

Shaheen Ghiassy


1 Answers

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.

like image 192
bredikhin Avatar answered Sep 24 '22 13:09

bredikhin