Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Typeorm creates migration file at the root

I'm generating migrations using TypeOrm in NestJS but I don't know why it creates the migration file at the root every time and I want it to automatically create the migration file into /src/server/migration/ folder.

ormconfig.ts

import * as dotenv from 'dotenv';
import { DataSource } from 'typeorm';

dotenv.config();

const connection = new DataSource({
  type: 'postgres' as const,
  host: 'localhost',
  port: 5432,
  username: 'username',
  password: 'password',
  database: 'database',
  entities: ['src/server/entity/*.{ts,js}'],
  migrations: ['src/server/migration/*.{ts,js}'],
  extra: {
    ssl: false,
  },
});

export default connection;

package.json

{
  "scripts": {
    "typeorm": "typeorm-ts-node-esm --dataSource ./ormconfig.ts",
    "migration:gen": "npm run typeorm migration:generate -n",
  },
  "dependencies": {
    "typeorm": "^0.3.6",
  }
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

add the following line to your ormconfig.ts file:

const connection = new DataSource({
.....

cli: {
    migrationsDir: "server/migration/"
}

....
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!