不要怂,就是干,撸起袖子干!

Commit 61482c0b by terraflubb

Make migrations more verbose and time migrations

1 parent 4c23c8a1
Showing with 12 additions and 2 deletions
......@@ -53,16 +53,26 @@ module.exports = (function() {
migrations.reverse()
}
if (migrations.length === 0) {
self.options.logging("There are no pending migrations.")
} else {
self.options.logging("Running migrations...")
}
migrations.forEach(function(migration) {
var migrationTime
chainer.add(migration, 'execute', [options], {
before: function(migration) {
if (self.options.logging !== false) {
self.options.logging('Executing migration: ' + migration.filename)
self.options.logging(migration.filename)
}
migrationTime = process.hrtime()
},
after: function(migration) {
migrationTime = process.hrtime(migrationTime)
migrationTime = Math.round( (migrationTime[0] * 1000) + (migrationTime[1] / 1000000));
if (self.options.logging !== false) {
self.options.logging('Executed migration: ' + migration.filename)
self.options.logging('Completed in ' + migrationTime + 'ms')
}
},
success: function(migration, callback) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!