Answer the question
In order to leave comments, you need to log in
How to properly set up migrations in typeorm?
Good day. So I could not figure out the migrations in Nest.Js
subscriber what is this for?
ormconfig.json
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "root",
"password": "root",
"database": "app1",
"entities": ["dist/**/*.entity{.ts,.js}"],
"synchronize": false,
"migrations": ["dist/migrations/**/*{.ts,.js}"],
"cli": {
"migrationsDir": "src/migrations"
}
}
"scripts": {
"typeorm": "ts-node --transpile-only ./node_modules/typeorm/cli.js", //взял с оф сайта TypeOrm example
"migrate:run": "npm run start && npm run typeorm migration:run",
"migrate:generate": "npm run start && npm run typeorm migration:generate -- -n",
"migrate:create": "npm run start && npm run typeorm migration:create -- -n",
"migrate:revert": "npm run start && npm run typeorm migration:revert",
"migrate:show": "npm run start && npm run typeorm migration:show",
"migrate:drop": "npm run start && npm run typeorm schema:drop",
"migrate:fresh": "npm run start && npm run typeorm schema:drop && npm run typeorm migration:run"
},
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config=ormconfig.json"
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js --config=ormconfig.json",
"typeorm": "ts-node --transpile-only ./node_modules/typeorm/cli.js"
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js --config=ormconfig.json"
typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config=ormconfig.json",
"devDependencies": {
"ts-node": "^10.0.0",
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question