Closed TobiasUhmann closed 2 years ago
Ok, I took the obvious way of getting the file's directory now by passing {migrationsDirectory: path.resolve(__dirname, 'migrations/')}
to migrate.load()
. But I think migrate.load()
should do that itself.
In my code, I run migrations programmatically via
migrate.load()
. The source file that callsmigrate.load()
lies in the project's root directory - next to themigrations
folder. When I start the app vianpm start
from the project root directory during development everything works fine.However, when packaging the app and running it in another directory via
npx
or running the app after having been installed globally vianpm install -g
, it breaks because it cannot find themigrations
directory.Apparently,
migrate.load()
is looking for themigrations
folder relative to the working directory. How can I tellmigrate.load()
to look relative to its source file so that I can run my app from another directory?