I created a TypeORM-based project intended for running migrations scripts only; I'm using the TypeORM CLI to run
, show
or revert
them, but not getting any output when do it.
The only case in which I'm getting output is when I run typeorm migration:create
or npm run migration:create
, but in the other cases the output is the same as the following:
This is the content of my package.json
so that you can see the scripts
and dependencies I'm using:
{
"name": "bgt-data-import",
"version": "0.0.1",
"description": "BGT Data Import",
"devDependencies": {
"ts-node": "^8.10.2",
"@types/node": "^9.6.5",
"typescript": "^3.9.6"
},
"dependencies": {
"aws-sdk": "^2.709.0",
"axios": "^0.19.2",
"dotenv": "^8.2.0",
"npm": "^6.14.5",
"pg": "^7.3.0",
"reflect-metadata": "^0.1.10",
"typeorm": "0.2.25"
},
"scripts": {
"start": "ts-node src/index.ts",
"typeorm": "node -r ts-node/register ./node_modules/typeorm/cli.js",
"migration:generate": "npm run typeorm migration:generate --config ./ormconfig.json --name",
"migration:run": "npm run typeorm migration:run --config ./ormconfig.json",
"migration:revert": "npm run typeorm migration:revert --config ./ormconfig.json",
"migration:show": "npm run typeorm migration:show --config ./ormconfig.json"
}
}
And this one is the ormconfig.json
content:
{
"type": "postgres",
"host": "localhost",
"port": 5656,
"username": "bgt_admin",
"password": "jnppem",
"database": "bgt",
"synchronize": false,
"logging": true,
"maxQueryExecutionTime": 100000,
"migrationsTableName": "data_import_migrations",
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
}
}
See the result of run npm run migration:show
I have the following packages installed, both locally and globally:
v3.9.6
(same version locally and globally)v8.10.2
(same version locally and globally)v0.2.25
(same version locally and globally)Also, I have NodeJS(v14.5.0
) and NPM(v6.14.5
) running on Ubuntu 18.04.
What could be the reason why I'm not getting any output when I run typeorm migration:[run|show|revert]
?
The reason why this issue was happening it’s due to ‘pg’ library in my ‘package.json’ isn’t compatible with Postgres’ version I’ve installed.
Once I installed the newest ‘pg’ library version in my project, the issue is no longer exists.