Database Migration
We are using migrate-mongo
database migration tool. Its CLI commands have npm script aliases for convenience of running in docker environment:
migrate:create
- alias formigrate-mongo create
migrate:status
- alias formigrate-mongo status
migrate:up
- alias formigrate-mongo up
migrate:down
- alias formigrate-mongo down
migrate
- alias formigrate:up
script
When upgrading manually in compose environment use:
docker compose run --rm app npm run migrate:status
This will bring up all app dependencies (mongoDb container) and execute required command.
Worker instance applies all pending upgrades automatically when starting.
In order to create new migration, run migrate-mongo create <name_of_migration>
, this will create a file in ./migrations
directory
which needs to be amended according to requirements. For examples please refer
to existing migrations or migrate-mongo
documentation.