Skip to content

Commit

Permalink
Change commands to run migrations as js (#1714)
Browse files Browse the repository at this point in the history
* Change commands to run migrations as js

* Remove unnecessary mkdir steps from build command in package.json

* Fix migrations address in ormconfig.ts
  • Loading branch information
ae2079 authored Jul 23, 2024
1 parent c217c1c commit 18f3239
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 && cp -r config ./build/config && 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",
Expand Down
2 changes: 1 addition & 1 deletion src/ormconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
// },
Expand Down

0 comments on commit 18f3239

Please sign in to comment.