typescriptfeathersjsfeathers-sequelize

How to run migrations in a feathersjs typescript project?


I'm wondering how to run Sequelize migrations on a typescript feathersjs project generated by feathers-plus CLI.

The guide at https://github.com/feathersjs-ecosystem/feathers-sequelize is only concerned with JS project. TS project where sequelize migrations config created exactly according to the doc will fail with not being able to find the app module.

ERROR: Cannot find module '../src/app'

How to get it working? (I don't want to go all out Typescript on Sequelize with 3rd party typings as I smell it would bring a whole new league of issues)


Solution

  • I found a very simple way to get it working. Just change the extensions on the migrations/config.js and migrations/models.js files to ts.

    So you now have migrations/config.ts and migrations/models.ts and you can run migrations in the usual way using sequelize db:migrate

    Voilá!