migrate-mongoose icon indicating copy to clipboard operation
migrate-mongoose copied to clipboard

Extension agnostic migrations

Open tenorok opened this issue 5 years ago • 4 comments

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.

tenorok avatar Feb 24 '20 20:02 tenorok

@tenorok have you tested this with a TS project?

nicmosc avatar Feb 26 '20 16:02 nicmosc

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.

tenorok avatar Feb 26 '20 18:02 tenorok

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!

nicmosc avatar Mar 04 '20 07:03 nicmosc

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 :-(

tenorok avatar Mar 04 '20 08:03 tenorok