Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "tableName" to execution log #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Restuta
Copy link

@Restuta Restuta commented Feb 18, 2019

Just makes output a little more readable.

@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants