Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Adding error reporting for failed migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Romanko committed Jun 30, 2014
1 parent 9ebfc0b commit 984a708
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tasks/sequelize.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ module.exports = function(grunt) {
migrator = sequelize.getMigrator(migratorOptions);
}

sequelize.migrate(migratorOptions).done(done);
sequelize.migrate(migratorOptions).success(done).error(function(err) {
grunt.log.error(err);
done(false);
});

});

Expand All @@ -68,11 +71,12 @@ module.exports = function(grunt) {
Meta.find({ order: 'id DESC' }).success(function(meta) {
if (meta) {
migrator = sequelize.getMigrator(_.extend(migratorOptions, meta.values), true);
migrator.migrate({ method: 'down' }).success(function() {
done();
migrator.migrate({ method: 'down' }).success(done).error(function(err) {
grunt.log.error(err);
done(false);
});
} else {
console.log('There are no pending migrations.');
grunt.log.writeln('There are no pending migrations.');
done();
}
});
Expand Down

0 comments on commit 984a708

Please sign in to comment.