@open-condo/migrator
v1.0.1
Published
CLI util to run code and infrastructure migrations for condo-based applications
Maintainers
Readme
@open-condo/migrator 
CLI util to run code and infrastructure migrations for condo-based applications.
NOTE: The documentation below describes how to use these package, but does not describe which migrations you need to run and why. For this information, go to our Migration Guides.
Table of contents
Local usage
You can use package in your condo monorepo fork by running the following command to build package:
yarn workspace @open-condo/migrator buildAnd then the one to run it:
npx @open-condo/migrator --helpRemote usage
Without installation
You can use migrator on remote instances without installing additional packages by running:
npx @open-condo/migrator@latest --helpWith installation
Or alternatively you can install it with:
yarn add -D @open-condo/migratorAnd then run with:
npx @open-condo/migrator --helpHow to run migration commands
List of commands and arguments
You can use the following command to explore list of all available commands:
npx @open-condo/migrator --helpThen you can explore command arguments / description by running the following:
npx @open-condo/migrator <command> --helpRunning command locally
You can migrate whole monorepo by running command from monorepo root. For example:
npx @open-condo/migrator add-apps-kv-prefixesOr you can more precisely run it for single / multiple apps:
npx @open-condo/migrator add-apps-kv-prefixes -f condo address-serviceRunning command on remote environments
You can also run migration commands on deployed applications where access .env files is not possible,
since environment variables are passed from external tools and apps are deployed "one per pod".
For this scenarios you can migrate single app at a time by running commands like this:
REDIS_URL=redis://remote_user:*******@127.0.0.1:6379/6 npx @open-condo/migrator add-apps-kv-prefixes -f condoNOTE: You can remove REDIS_URL=** part if environment variables are already set (from
exportor other external tool)
You can also run migrator from specific app folder instead of using --filter arg:
cd apps/condo
npx @open-condo/migrator add-apps-kv-prefixesAvailable commands
add-apps-kv-prefixes
This command will add keyPrefix to all your keys of your KV database (Redis).
For example, for condo app new keys will look like this:
my_key->condo:my_keysess:asd123ghj->condo:sess:asd123ghjbull:low:importMeters:123->{condo:bull:low}:importMeters:123
You can read more about our motivation and key format in our Migration Guides
