I tried this a lot but now I think I need some help. I have a nx-monorepo with angular-frontend and nestjs backend. Now I added a Postgres-SQL database with TypeORM. Everything is working fine, connection to Database is running, api-calls coming in, etc. But I can't add the generate migration script. I added a run-command for my backend-project:
"generate-migration": {
"builder": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "ts-node ../../node_modules/.bin/typeorm migration:generate -n",
"cwd": "apps/api"
}
}
I can run the command by "npm run api:generate-migration" but it results with this error:
Error during migration generation: /apps/api/src/model/base.entity.ts:1 import { __decorate, __metadata } from "tslib"; ^^^^^^
SyntaxError: Cannot use import statement outside a module at wrapSafe (node:internal/modules/cjs/loader:1024:16) at Module._compile (node:internal/modules/cjs/loader:1072:27) at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1056:23) at Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Object.require.extensions. [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1059:12) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:997:19) at require (node:internal/modules/cjs/helpers:92:18) at /Users/IsabelleGlasmacher/Documents/Programme/save_easytonomy/src/util/DirectoryExportedClassesLoader.ts:41:22 ERROR: Something went wrong in @nrwl/run-commands - Command failed: ts-node ../../node_modules/.bin/typeorm migration:generate -n
ormConfig.json:
{
...
"type": "postgres",
"migrationsTableName": "migration",
"migrations": ["src/migration/*.ts"],
"cli": {
"migrationsDir": "src/migration"
},
"ssl": false
}
Does anybody know something about that and could help me? Please :)