Open sundeepgupta opened 8 years ago
I'm implementing the migration in a boot script before my actual application code is run like this:
const loopback = require('loopback'); const Migration = loopback.getModel('Migration'); module.exports = app => { Migration.migrate('up', error => { if (error) { console.error('Error in migrations: %s', error.stack); return; } console.log('boot app now'); }); };
This works when there are actual migrations pending. However, if not, I see "No new migrations to run." outputted, but the "boot app now" log line never gets executed.
If I put cb() here: https://github.com/fullcube/loopback-component-migrate/blob/master/lib/models/migration.js#L152, it works ok, but I'm pretty sure that's not correct, also, this wouldn't return a promise. I'm not sure how to fix this in the right way.
cb()
Find another way for fixing this issues
//life hack:( Migration.on('complete', cb); Migration.migrate('up', cb); https://guides.github.com/features/mastering-markdown/
I'm implementing the migration in a boot script before my actual application code is run like this:
This works when there are actual migrations pending. However, if not, I see "No new migrations to run." outputted, but the "boot app now" log line never gets executed.
If I put
cb()
here: https://github.com/fullcube/loopback-component-migrate/blob/master/lib/models/migration.js#L152, it works ok, but I'm pretty sure that's not correct, also, this wouldn't return a promise. I'm not sure how to fix this in the right way.