ani chan
ani chan

Reputation: 71

npx typeorm migration:create -n TestData Dosen't create a migration

enter image description here

I wasn't able to create a migration even after following doc.

Upvotes: 1

Views: 391

Answers (1)

Matheus
Matheus

Reputation: 150

Since the update (I don't know which, exactly), the flag -n was replaced by -o.

So, now you need to run.

typeorm migration:create -o path/to/my/migration

If you are using multiple datasources

migration:create doesn't work with specific datasources, so I reccomend you to add two scripts in "scripts" session at package.json like the following:

default typeorm (that you will use for non-specific database stuff):

"typeorm": "ts-node-dev ./node_modules/typeorm/cli.js"

your custom typeorm (that you will use for your specific database stuff, like run & revert migrations):

"myTypeorm":"ts-node-dev ./node_modules/typeorm/cli.js -d path/to/my/ormconfig.ts"

Upvotes: 1

Related Questions