Skip to content

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

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

Closed
dschinkel opened this issue Feb 7, 2022 · 2 comments
Closed

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

dschinkel opened this issue Feb 7, 2022 · 2 comments

Comments

@dschinkel
Copy link

dschinkel commented Feb 7, 2022

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',
},
@dschinkel
Copy link
Author

related 557

@dschinkel
Copy link
Author

dschinkel commented Feb 7, 2022

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'),
  },
});

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

No branches or pull requests

1 participant