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

Fix for bug with nested parameters #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

msulima
Copy link

@msulima msulima commented Oct 11, 2013

Hi, I've noticed that if you pass an option with nested properties, for example:

options: {
    locations: "sql",
    placeholders: {
        schema: "dbo",
        database_name: "my_database"
    }
}

then a wrong shell command is generated:

-locations="sql" -placeholders.0="undefined" -placeholders.1="undefined"

That's because for ... in loop in tasks/flyway.js:184 iterates over array [0, 1], not ['schema', 'placeholder'].

A simple fix for that would be:

Object.keys(options[option]).forEach(function (parameter) {
    flywayCommand += Util.format(' -%s.%s="%s"', option, parameter, options[option][parameter]);
});

That's exaclty how @Xylem has proposed it in his pull request: Xylem@8f72a4b#diff-38454901a786ea5ef27bd2be1e76b221R162 .

However I though it would be better to move command parameters building operation to a separate file, extend by adding more nesting levels and write some tests for it. Could you include these changes in your plugin?

msulima added 2 commits October 11, 2013 09:24
…th tests.

Fix for nested parameters string generation (i.e. placeholders).
@bgaillard bgaillard self-assigned this Feb 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants