db-migrate/node-db-migrate

Sending in Options for getInstance doesn't seem to do anything

dschinkel opened this issue · 2 comments

Now, I'm sure I have this wrong.
Yes I've looked at your docs
Yes it's probably something stupid I'm missing but I need another set of eyes on this

Am I passing the key/value pairs in terms of what your API expects as in structure here?

const dbmigrate = DBMigrate.getInstance(true, {
	config: 'database.json',
	env: 'dev',
	cmdOptions: {
		m: './migrations',
	},
});

https://db-migrate.readthedocs.io/en/latest/API/programable

Options

cwd - working directory (default: process.cwd)
config
string - location of the database.json file
object - hash of [configuration](https://umigrate.readthedocs.org/projects/db-migrate/en/latest/Getting%20Started/configuration/) options
cmdOptions - hash of CMD options from [Basic Usage](https://db-migrate.readthedocs.io/en/latest/Getting%20Started/installation/)

So I added an object literal for options but doesn't seem like any of this is quite right in terms of structure in mine so can you verify my structure. I need to be able to specify migrations-dir which in this object I just keyed it with an m.

the migrations directory is at the same level as my database.json. And I am running the dbMigrate command from that same directory as well.

Also tried:

cmdOptions: {
  'migrations-dir': '.',
},

and

cmdOptions: {
  'migrations-dir': './migrations',
},

related 557

figured it out finally

const dbmigrate = DBMigrate.getInstance(true, {
  config: path.join(__dirname, './database.json'),
  env: 'dev',
  cmdOptions: {
    'migrations-dir': path.join(__dirname, '/migrations/test'),
  },
});