Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,8 @@ module.exports = {
if (index < migrationCommands.length)
{
let command = migrationCommands[index];
console.log("[#"+index+"] execute: " + command.fn);
const tableName = (command.params && command.params[0]) || '<no table name>'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project already depends on lodash. You could consider doing this instead:

const tableName = _.get(command, 'params[0]', '<no table name>');

Copy link
Author

@Restuta Restuta Mar 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PaulMest thanks, I considered and in this specific case I feel like it comes down to personal preference, I don't see strong advantage of one or the other approach for the level of nesting of 2. For fields that are 3+ levels deep I think _.get has significant advantages.

console.log("[#"+index+"] execute: " + command.fn + " " + tableName);
index++;
queryInterface[command.fn].apply(queryInterface, command.params).then(next, reject);
}
Expand Down