Skip to content

db-migrate version 1.0 fails with "cannot find module" when migration directory is not the standard one #720

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
1 of 3 tasks
vladimirtiukhtin opened this issue Dec 25, 2020 · 1 comment

Comments

@vladimirtiukhtin
Copy link

I'm submitting a...

  • Bug report
  • Feature request
  • Question

Current behavior

My command line is

db-migrate -m test -e test up

While version 0.11.11 works fine, version 1.0.0-beta.13 fails with

[ERROR] unhandledRejection
[ERROR] Error: Cannot find module 'test/20201217180525-init.js'
Require stack:
- /opt/node_modules/db-migrate/lib/file.js
- /opt/node_modules/db-migrate/lib/commands/helper/migration-hook.js
- /opt/node_modules/db-migrate/lib/commands/up.js
- /opt/node_modules/db-migrate/lib/commands/index.js
- /opt/node_modules/db-migrate/api.js
- /opt/node_modules/db-migrate/index.js
- /usr/local/lib/node_modules/db-migrate/bin/db-migrate
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at File.get (/opt/node_modules/db-migrate/lib/file.js:84:48)
    at /opt/node_modules/db-migrate/lib/walker.js:185:28
    at tryCatcher (/opt/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/opt/node_modules/bluebird/js/release/reduce.js:166:18)
    at Object.gotAccum (/opt/node_modules/bluebird/js/release/reduce.js:155:25)
    at Object.tryCatcher (/opt/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/opt/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/opt/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromiseCtx (/opt/node_modules/bluebird/js/release/promise.js:641:10)
    at _drainQueueStep (/opt/node_modules/bluebird/js/release/async.js:97:12)
    at _drainQueue (/opt/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/opt/node_modules/bluebird/js/release/async.js:102:5)

Renaming folder back to "migrations" makes it work, but down migration fails anyway with

[ERROR] Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = '__dbmigrate_state__'' at line 3

Expected behavior

Same as 0.11.11, just work

Minimal reproduction of the problem with instructions

Create migrations in non-standard folder, specify it using "-m" flag

Environment


db-migrate version: 1.0.0-beta.13

Additional information:
- Node version: v14.15.3
- Platform:  Alpine Linux v3.11
@wzrdtales
Copy link
Member

thank you for reporting! fix will come shortly

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

2 participants