Skip to content
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

Migration CLI --from/--to options do not work with custom migration file names. #883

Closed
slnz00 opened this issue Sep 28, 2020 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@slnz00
Copy link

slnz00 commented Sep 28, 2020

Describe the bug
When using --from or --to cli options a Migration prefix gets appended to the beginning of the given file name. CLI crashes when the previously mentioned options are used with custom migration names.

Migrator.ts#L139

Stack trace

Error: Unable to find migration: Migration20200928151522-migration
at Umzug.<anonymous> (mikro-orm-graphql-example-master/node_modules/umzug/lib/index.js:536:41)
at Umzug.tryCatcher (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:673:18)
at Promise._resolveCallback (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:466:57)
at Promise._settlePromiseFromHandler (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:559:17)
at Promise._settlePromise (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:673:18)
at Promise._resolveCallback (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:466:57)
at Promise._settlePromiseFromHandler (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:559:17)
at Promise._settlePromise (mikro-orm-graphql-example-master/node_modules/bluebird/js/release/promise.js:604:18)

To Reproduce
Steps to reproduce the behavior:

  1. Use a custom migration file name generator (Configuration.migrations.fileName). E.g.: (timestamp: string) => '${timestamp}-migration'
  2. Generate at least 2 migrations. (migration:create)
  3. Apply the migrations. (migration:up)
  4. Revert to the first migration. (migration:down --to [first-migration.ts])

Expected behavior
Migrations should be reverted based on the given --from, --to options.

Additional context

Versions

Dependency Version
node 14.11.0
typescript 3.9.7
mikro-orm 4.0.5
pg 8.2.1
@B4nan B4nan added the bug Something isn't working label Sep 28, 2020
@B4nan B4nan closed this as completed in 80e5b58 Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants