Skip to content

Commit be77e0f

Browse files
authored
config: add script to run migrations (#3369)
* 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 <maciej@jaworski.app>
1 parent 4048d1b commit be77e0f

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:origin-backend &&
4+
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:organization &&
5+
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:issuer &&
6+
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:device-registry-irec
7+
yarn --cwd ../../traceability/issuer-irec-api typeorm:run:prod &&
8+
yarn --cwd ../../trade/exchange-irec typeorm:run:device-registry &&
9+
yarn --cwd ../../trade/exchange-irec typeorm:run:organization &&
10+
yarn --cwd ../../trade/exchange-irec typeorm:run:origin-backend &&
11+
yarn --cwd ../../trade/exchange-irec typeorm:run:device-registry-irec &&
12+
yarn --cwd ../../trade/exchange-irec typeorm:run:prod &&
13+
yarn --cwd ../../devices/origin-device-registry-irec-local-api typeorm:run:prod

packages/apps/origin-backend-irec-app/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
"test:mocha": "mocha -r ts-node/register test/*.e2e-spec.ts --timeout 60000 --exit",
2020
"test:e2e": "yarn test:mocha",
2121
"build:container:canary": "make build-canary",
22-
"build:container:latest": "make build-latest"
22+
"build:container:latest": "make build-latest",
23+
"migrate:prod": "./bin/migrate"
2324
},
2425
"bin": {
25-
"origin-backend-irec-app": "./bin/origin-backend-irec-app"
26+
"origin-backend-irec-app": "./bin/origin-backend-irec-app",
27+
"migrate": "./bin/migrate"
2628
},
2729
"homepage": "https://github.com/energywebfoundation/origin/tree/master/packages/origin-backend-irec-app#readme",
2830
"repository": {

packages/devices/origin-device-registry-irec-local-api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
2626
"typeorm:migrate": "yarn typeorm migration:generate -- -n",
2727
"typeorm:run": "yarn typeorm migration:run",
28+
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
2829
"typeorm:drop": "yarn typeorm schema:drop",
2930
"typeorm:dropAndMigrate": "yarn typeorm:drop && yarn typeorm:run",
3031
"precommit": "lint-staged"

packages/traceability/issuer-irec-api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"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",
2828
"clean": "shx rm -rf dist dist-shakeable",
2929
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
30+
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
3031
"typeorm:migrate": "yarn typeorm migration:generate -- -n",
3132
"typeorm:run": "yarn typeorm migration:run",
3233
"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",

packages/trade/exchange-irec/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig-dev.ts",
3434
"typeorm:migrate": "yarn typeorm migration:generate -n",
3535
"typeorm:run": "yarn typeorm migration:run",
36+
"typeorm:run:prod": "node_modules/typeorm/cli.js migration:run --config dist/js/ormconfig.js",
3637
"typeorm:drop": "yarn typeorm schema:drop",
3738
"typeorm:dropAndMigrate": "yarn typeorm:drop && yarn typeorm:run",
3839
"typeorm:run:issuer": "node_modules/typeorm/cli.js migration:run --config node_modules/@energyweb/issuer-irec-api/dist/js/ormconfig.js",

0 commit comments

Comments
 (0)