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

Support Migration files with *.ts extension

Open mkovel opened this issue 4 years ago • 4 comments

Hey, we use Typescript + Mongoose in our project and tried use migrate-mongoose for adding migrations. But migrate-mongoose filtering files by reg-pattern, /\d{13,}\-.+.js$/.test(file)) can we change a little /\d{13,}\-.+.(j|t)s$/.test(file)). Or create new config param for this. Thanks

mkovel avatar Mar 26 '20 18:03 mkovel

I would appreciate support for Typescript files as well 👍

pavel-lens avatar Aug 18 '20 12:08 pavel-lens

This day and age, Typescript is so popular and support is incredibly easy to add it's rare to find a relevant project that doesn't support it even if it's just via a definition file. Hopefully this makes it into the next release!

troywweber7 avatar Jan 12 '21 15:01 troywweber7

Same here, curious if you can somehow allow parsing of the files using ts-node.

andrewmartin avatar Jan 23 '21 22:01 andrewmartin

Same here, curious if you can somehow allow parsing of the files using ts-node.

Here is how I did it:

"scripts": {
  "migrate_prod": "migrate up --autosync",
  "migrate_dev": "ts-node ./node_modules/migrate-mongoose/src/cli.js up --autosync"
}

On development machine, use npm run migrate_dev. On production server, you need to compile the project into .js code then run migrate_prod

longseespace avatar Feb 22 '22 09:02 longseespace