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

533
Views
TypeORM CLI - How to run MIGRATIONS on a SPECIFIC DATABASE

My ormconfig.json has multiple DBs, how to run migrations for a SPECIFIC DB of this list? In the example below I have the dev db with migrations already set, now I need to set migrations for the other db called test.

I wanted to run a command like this:

yarn typeorm migration:run --database test

// ormconfig.json

[
  {
    "name": "dev",
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "synchronize": true,
    "logging": true,
    "entities": ["src/typeorm/entity/**/*.ts"],
    "migrations": ["src/typeorm/migration/**/*.ts"],
    "subscribers": ["src/typeorm/subscriber/**/*.ts"],
    "cli": {
      "entitiesDir": "src/typeorm/entity",
      "migrationsDir": "src/typeorm/migration",
      "subscribersDir": "src/typeorm/subscriber"
    }
  },
  {
    "name": "test",
    "type": "postgres",
    "host": "localhost",
    "port": 5433,
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "synchronize": true,
    "logging": false,
    "entities": ["src/typeorm/entity/**/*.ts"],
    "migrations": ["src/typeorm/migration/**/*.ts"],
    "subscribers": ["src/typeorm/subscriber/**/*.ts"],
    "cli": {
      "entitiesDir": "src/typeorm/entity",
      "migrationsDir": "src/typeorm/migration",
      "subscribersDir": "src/typeorm/subscriber"
    }
  }
]
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Just run:

yarn typeorm migration:run -c configName where configName is the name of the configuration in your ormconfig.json db list.

over 4 years ago · Santiago Trujillo 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!