From a36d681b5509e908098d67974c1ff90cb70a9040 Mon Sep 17 00:00:00 2001 From: Ali Ebrahimi <65724329+ae2079@users.noreply.github.com> Date: Thu, 25 Jul 2024 03:27:24 +0330 Subject: [PATCH] Revert "Revert "Run migrations as js files (#1718)" (#1724)" This reverts commit 5bbe52348ba1f3e020ba6d9878963ad2f0ff01fd. --- package.json | 14 +++++++------- src/ormconfig.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 95392122a..226fa8c18 100644 --- a/package.json +++ b/package.json @@ -206,16 +206,16 @@ "start": "NODE_ENV=development ts-node-dev --project ./tsconfig.json --respawn ./src/index.ts", "start:test": "NODE_ENV=development ts-node-dev --project ./tsconfig.json --respawn ./test.ts", "serve": "pm2 startOrRestart ecosystem.config.js --node-args='--max-old-space-size=8192'", - "db:migrate:run:test": "NODE_ENV=test npx typeorm-ts-node-commonjs migration:run -d ./src/ormconfig.ts", - "db:migrate:revert:test": "NODE_ENV=test npx typeorm-ts-node-commonjs migration:revert -d ./src/ormconfig.ts", - "db:migrate:run:local": "NODE_ENV=development npx typeorm-ts-node-commonjs migration:run -d ./src/ormconfig.ts", - "db:migrate:revert:local": "NODE_ENV=development npx typeorm-ts-node-commonjs migration:revert -d ./src/ormconfig.ts", - "db:migrate:run:production": "NODE_ENV=production npx typeorm-ts-node-commonjs migration:run -d ./src/ormconfig.ts", - "db:migrate:rever:productiont": "NODE_ENV=production npx typeorm-ts-node-commonjs migration:revert -d ./src/ormconfig.ts", + "db:migrate:run:test": "NODE_ENV=test typeorm migration:run -d ./build/src/ormconfig.js", + "db:migrate:revert:test": "NODE_ENV=test typeorm migration:revert -d ./build/src/ormconfig.js", + "db:migrate:run:local": "npm run build && NODE_ENV=development typeorm migration:run -d ./build/src/ormconfig.js", + "db:migrate:revert:local": "npm run build && NODE_ENV=development typeorm migration:revert -d ./build/src/ormconfig.js", + "db:migrate:run:production": "npm run build && NODE_ENV=production typeorm migration:run -d ./build/src/ormconfig.js", + "db:migrate:revert:production": "npm run build && NODE_ENV=production typeorm migration:revert -d ./build/src/ormconfig.js", "prettify": "prettier --write '**/*.ts*' '**/*.test.ts*'", "db:migrate:seedToken:run": "NODE_ENV=development ts-node ./node_modules/typeorm/cli -f ./src/seedToken-ormconfig.ts migration:run", "db:migrate:seedToken:revert": "NODE_ENV=development ts-node ./node_modules/typeorm/cli -f ./src/seedToken-ormconfig.ts migration:revert", - "build": "rm -rf ./build && tsc && mkdir ./build/config && mkdir ./build/src/server/adminJs/tabs/components && cp -r src/server/adminJs/tabs/components/* ./build/src/server/adminJs/tabs/components/ && mkdir ./build/src/utils/locales && cp -r ./src/utils/locales/* ./build/src/utils/locales/ && cp -r ./src/abi build/src/abi ", + "build": "rm -rf ./build && tsc && mkdir -p ./build/config && if [ -d config ]; then cp -r config/* ./build/config/; fi && cp -r src/server/adminJs/tabs/components ./build/src/server/adminJs/tabs/components && cp -r ./src/utils/locales ./build/src/utils/locales && cp -r ./src/abi build/src/abi", "dev": "NODE_ENV=development node ./build/src/index.js", "production": "NODE_ENV=production node ./build/src/index.js", "start:docker:server": "npm run db:migrate:run:production && npm run production", diff --git a/src/ormconfig.ts b/src/ormconfig.ts index bfb4c35d1..00dc7fb0b 100644 --- a/src/ormconfig.ts +++ b/src/ormconfig.ts @@ -29,7 +29,7 @@ const ormConfig: DataSourceOptions = { password: process.env.TYPEORM_DATABASE_PASSWORD, database: process.env.TYPEORM_DATABASE_NAME, entities: getEntities(), - migrations: ['migration/*.ts'], + migrations: [path.join(__dirname, '../migration/*.js')], // cli: { // migrationsDir: 'migration', // },