Skip to content

Commit

Permalink
perform db migration only in production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Feb 25, 2018
1 parent 1fb2c41 commit 06f63d0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions api/core/task/task.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ module.exports = function(cb){

// start sunrise & sunset schedule
gladys.sun.init().catch(sails.log.warn);

// check if db migration is needed
gladys.task.checkDbVersion()
.then(() => {
sails.log.info('Successfully checked DB version.');
cb();
})
.catch((err) => {
sails.log.error(`Error while performing DB migration.`);
sails.log.error(err);
cb();
});

gladys.brain.load()
.then(() => {
Expand All @@ -33,8 +21,20 @@ module.exports = function(cb){
gladys.alarm.checkAllAutoWakeUp();

if(sails.config.environment !== 'production') {
return ;
return cb();
}

// check if db migration is needed
gladys.task.checkDbVersion()
.then(() => {
sails.log.info('Successfully checked DB version.');
cb();
})
.catch((err) => {
sails.log.error(`Error while performing DB migration.`);
sails.log.error(err);
cb();
});


// tasks started only in prod
Expand Down

0 comments on commit 06f63d0

Please sign in to comment.