Skip to content

Commit 0a556f9

Browse files
committed
Optimised logging for the new migration files
refs #9742
1 parent 91152ef commit 0a556f9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

core/server/data/migrations/versions/2.0/1-rename-amp-column.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const common = require('../../../../lib/common'),
33
columnNameOld = 'amp',
44
columnNameNew = 'comment_id',
55
message1 = `Renaming column ${columnNameOld} to ${columnNameNew}`,
6-
message2 = `Renaming column ${columnNameNew} to ${columnNameOld}`;
6+
message2 = `Renaming column ${columnNameNew} to ${columnNameOld}`,
7+
message3 = `Renamed column ${columnNameOld} to ${columnNameNew}`,
8+
message4 = `Renamed column ${columnNameNew} to ${columnNameOld}`;
79

810
module.exports.up = function renameAmpColumn(options) {
911
const connection = options.connection;
@@ -17,6 +19,9 @@ module.exports.up = function renameAmpColumn(options) {
1719
t.renameColumn(columnNameOld, columnNameNew);
1820
});
1921
}
22+
})
23+
.then(() => {
24+
common.logging.info(message3);
2025
});
2126
};
2227

@@ -32,5 +37,8 @@ module.exports.down = function renameCommentIdColumn(options) {
3237
t.renameColumn(columnNameNew, columnNameOld);
3338
});
3439
}
40+
})
41+
.then(() => {
42+
common.logging.info(message4);
3543
});
3644
};

core/server/data/migrations/versions/2.0/2-update-posts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const _ = require('lodash'),
22
Promise = require('bluebird'),
33
common = require('../../../../lib/common'),
44
models = require('../../../../models'),
5-
message1 = 'Updating post data (comment_id)';
5+
message1 = 'Updating post data (comment_id)',
6+
message2 = 'Updated post data (comment_id)';
67

78
module.exports.config = {
89
transaction: true
@@ -28,5 +29,8 @@ module.exports.up = function updatePosts(options) {
2829
comment_id: post.id
2930
}, _.merge({id: post.id}, localOptions));
3031
}, {concurrency: 100});
32+
})
33+
.then(() => {
34+
common.logging.info(message2);
3135
});
3236
};

0 commit comments

Comments
 (0)