Skip to content

Commit

Permalink
Optimised logging for the new migration files
Browse files Browse the repository at this point in the history
refs #9742
  • Loading branch information
kirrg001 committed Jul 22, 2018
1 parent 4394a11 commit ca3bc62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion core/server/data/migrations/versions/2.0/1-rename-amp-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const common = require('../../../../lib/common'),
columnNameOld = 'amp',
columnNameNew = 'comment_id',
message1 = `Renaming column ${columnNameOld} to ${columnNameNew}`,
message2 = `Renaming column ${columnNameNew} to ${columnNameOld}`;
message2 = `Renaming column ${columnNameNew} to ${columnNameOld}`,
message3 = `Renamed column ${columnNameOld} to ${columnNameNew}`,
message4 = `Renamed column ${columnNameNew} to ${columnNameOld}`;

module.exports.up = function renameAmpColumn(options) {
const connection = options.connection;
Expand All @@ -17,6 +19,9 @@ module.exports.up = function renameAmpColumn(options) {
t.renameColumn(columnNameOld, columnNameNew);
});
}
})
.then(() => {
common.logging.info(message3);
});
};

Expand All @@ -32,5 +37,8 @@ module.exports.down = function renameCommentIdColumn(options) {
t.renameColumn(columnNameNew, columnNameOld);
});
}
})
.then(() => {
common.logging.info(message4);
});
};
6 changes: 5 additions & 1 deletion core/server/data/migrations/versions/2.0/2-update-posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const _ = require('lodash'),
Promise = require('bluebird'),
common = require('../../../../lib/common'),
models = require('../../../../models'),
message1 = 'Updating post data (comment_id)';
message1 = 'Updating post data (comment_id)',
message2 = 'Updated post data (comment_id)';

module.exports.config = {
transaction: true
Expand All @@ -28,5 +29,8 @@ module.exports.up = function updatePosts(options) {
comment_id: post.id
}, _.merge({id: post.id}, localOptions));
}, {concurrency: 100});
})
.then(() => {
common.logging.info(message2);
});
};

0 comments on commit ca3bc62

Please sign in to comment.