balmasi / migrate-mongoose

A node based migration framework for mongoose supporting ES6 migrations
MIT License
262 stars 83 forks source link

Extension agnostic migrations #58

Open tenorok opened 4 years ago

tenorok commented 4 years ago

Currently migrate-mongoose made only for using with migration files with js extension. This changes make possible:

  1. Creating new migrations files with the same extension as template file.
  2. Using extension other than js, like ts for example in development mode (with ts-node for example).

Sorry for irrelevant changes like removing extra spaces (thanks to my editor) – I can reset their if it matters.

nicmosc commented 4 years ago

@tenorok have you tested this with a TS project?

tenorok commented 4 years ago

Yes, I faced with a problem of usage migrate-mongoose into typescript-project working on ts-node in development mode and currently use my fork for it.

Migrations continue works well after compiling project into javascript.

nicmosc commented 4 years ago

Tried your fork on our own TS project and it works well! Though I think it would make more sense if rather than omitting the extension altogether it was kept throughout, I guess by passing the extension variable around. That will make it more explicit and less prone to error. Do you think you can make those changes? Thanks!

tenorok commented 4 years ago

I have not understood what specific problems this will solve? Lack of binding to a specific extension works flexibly with any files, without the need to enter redundant options and hardcode extensions.

I wrote email to @balmasi about this pull request but so far he is silent. Not sure that it’s possible to merge it in at all :-(