Running migrations on db stored in app.getPath(‘userData’)



I am using Sequelize with sqlite and am storing the database.sqlite file on app.getPath(‘userData’) to persist the data between app updates.

I am trying to run database migrations with umzug which works when the app is not packaged, but not when the app is packaged because of a MODULE_NOT_FOUND error. An example path is /Users/…db/migrations/1-migration.js

I put the migrations in “extraResources” and the path to the migrations is correct. I am able to require the migration files from node in the terminal, but they are throwing the MODULE_NOT_FOUND error when required from the packaged application. Is there a reason that requiring a module from outside of app.asar from within app.asar would fail?

I have also tried adding the migration files to “files” and changing the migration path to within the app, but the same error occurs.

Any ideas?