Skip to content

Commit

Permalink
config: add script to run migrations (#3369)
Browse files Browse the repository at this point in the history
* config: add script to run '@energyweb/origin-backend-irec-app' migrations from container

* refactor: replace changing dir with yarn cwd param

Co-authored-by: mjaworski <[email protected]>
  • Loading branch information
mjavor and mjaworski authored Nov 29, 2022
1 parent 4048d1b commit be77e0f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
13 changes: 13 additions & 0 deletions packages/apps/origin-backend-irec-app/bin/migrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

yarn --cwd ../../traceability/issuer-irec-api typeorm:run:origin-backend &&
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:organization &&
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:issuer &&
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:device-registry-irec
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:prod &&
yarn --cwd ../../trade/exchange-irec typeorm:run:device-registry &&
yarn --cwd ../../trade/exchange-irec typeorm:run:organization &&
yarn --cwd ../../trade/exchange-irec typeorm:run:origin-backend &&
yarn --cwd ../../trade/exchange-irec typeorm:run:device-registry-irec &&
yarn --cwd ../../trade/exchange-irec typeorm:run:prod &&
yarn --cwd ../../devices/origin-device-registry-irec-local-api typeorm:run:prod
6 changes: 4 additions & 2 deletions packages/apps/origin-backend-irec-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
"test:mocha": "mocha -r ts-node/register test/*.e2e-spec.ts --timeout 60000 --exit",
"test:e2e": "yarn test:mocha",
"build:container:canary": "make build-canary",
"build:container:latest": "make build-latest"
"build:container:latest": "make build-latest",
"migrate:prod": "./bin/migrate"
},
"bin": {
"origin-backend-irec-app": "./bin/origin-backend-irec-app"
"origin-backend-irec-app": "./bin/origin-backend-irec-app",
"migrate": "./bin/migrate"
},
"homepage": "https://github.com/energywebfoundation/origin/tree/master/packages/origin-backend-irec-app#readme",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
"typeorm:migrate": "yarn typeorm migration:generate -- -n",
"typeorm:run": "yarn typeorm migration:run",
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
"typeorm:drop": "yarn typeorm schema:drop",
"typeorm:dropAndMigrate": "yarn typeorm:drop && yarn typeorm:run",
"precommit": "lint-staged"
Expand Down
1 change: 1 addition & 0 deletions packages/traceability/issuer-irec-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"start-ganache": "ganache-cli -m 'chalk park staff buzz chair purchase wise oak receive avoid avoid home' -l 8000000 -e 1000000 -a 20 -p 8581 -q",
"clean": "shx rm -rf dist dist-shakeable",
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
"typeorm:migrate": "yarn typeorm migration:generate -- -n",
"typeorm:run": "yarn typeorm migration:run",
"typeorm:run:all": "yarn typeorm:run:origin-backend && yarn typeorm:run:organization && yarn typeorm:run:issuer && yarn typeorm:run:device-registry-irec && yarn typeorm migration:run",
Expand Down
1 change: 1 addition & 0 deletions packages/trade/exchange-irec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
"typeorm:migrate": "yarn typeorm migration:generate -n",
"typeorm:run": "yarn typeorm migration:run",
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
"typeorm:drop": "yarn typeorm schema:drop",
"typeorm:dropAndMigrate": "yarn typeorm:drop && yarn typeorm:run",
"typeorm:run:issuer": "node_modules/typeorm/cli.js migration:run --config node_modules/@energyweb/issuer-irec-api/dist/js/ormconfig.js",
Expand Down

0 comments on commit be77e0f

Please sign in to comment.