Skip to content

getInstance is not respecting cmdOptions correctly #557

Closed
@BorntraegerMarc

Description

@BorntraegerMarc

I'm submitting a...

  • Bug report
  • Feature request
  • Question

Current behavior

With this PR #555 we introduced the feature to pass in cmdOptions programatically. So I included it in my project like this:

dbMigrate.getInstance(true, {
            cwd: '../komed-emr',
            env: 'dev',
            cmdOptions: {
                'migrations-dir': './build/src/migrations'
            }
});

But I noticed that it does not work. The cmdOptions actually never are considered. So I added in this line: https://github.com/db-migrate/node-db-migrate/blob/master/lib/commands/set-default-argv.js#L101 a console.log: console.log(internals);

This was the output:

{ onComplete: [Function],
  migrationProtocol: 1,
  isModule: true,
  plugins: { overwrite: [Function: overwrite], hook: [Function: hook] },
  dbm:
   {  },
  currentEnv: 'dev',
  cwd: '../komed-emr' }

As seen the passed in cmdOptions are never included.

Expected behavior

The cmdOptions are included and passed into the method.

I tried to debug the lib but couldn't find the root cause. Maybe you @wzrdtales could point me again to the place where the bug occurs and I could do a new PR to fix it.

Environment


db-migrate version: 0.10.6
db-migrate driver with versions: mongodb 1.4.0 

Additional information:
- Node version: v8.9.1  
- Platform: Windows 

Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions