-
-
Notifications
You must be signed in to change notification settings - Fork 363
Closed
Description
I'm trying to run migrations at start up of the server. Problem is I launch the server with CLI arguments that conflict with db-migrate's. db-migrate tries to use those arguments but they aren't at all intended for db-migrate.
For example, specifying test timeout of test runner lab using the -m CLI argument:
NODE_ENV=test DATABASE_URL=postgres://[email protected]:5432/mydb node_modules/.bin/lab -m 10000 test/integration
throws the following error:
{ err: null,
originalErr:
{ [Error: ENOENT: no such file or directory, scandir '/Users/myuser/projects/myproject/ 10000']
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/Users/myuser/projects/myproject/ 10000' } }
because db-migrate interprets the -m CLI argument as the migrations directory.
This leakage of CLI arguments should not occur. Eventually it would be nice to be able to specify any option exposed by the CLI to the programmable API.
Here's the snippet that throws the error:
const dbMigrate = require('db-migrate').getInstance(true)
dbMigrate.up()