From 984a708d2abb92a0a1ab0bb3c4704e711305841d Mon Sep 17 00:00:00 2001 From: Brian Romanko Date: Sun, 29 Jun 2014 19:42:25 -0700 Subject: [PATCH] Adding error reporting for failed migrations --- tasks/sequelize.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks/sequelize.js b/tasks/sequelize.js index 66ee45e..f70d479 100644 --- a/tasks/sequelize.js +++ b/tasks/sequelize.js @@ -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); + }); }); @@ -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(); } });