question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeORM migrations

See original GitHub issue

Hi, Is there a way to run migrations with defining the connection as described in the docs?

export const databaseProviders = [
  {
    provide: DB_CON_TOKEN,
    useFactory: async () => await createConnection({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      username: 'root',
      password: 'root',
      database: 'test',
      entities: [
        __dirname + '/../**/*.entity{.ts,.js}',
      ],
      migrations: [
        __dirname + '/migrations/*.migration{.ts,.js}'
      ]
    }),
  },
]; 

The only option I see is to configure 2 dbConnections, one for nest (for the repository/entity) and one for TypeORM for the migrations.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
vlio20commented, Oct 24, 2017

awesome! thanks for providing the example

0reactions
lock[bot]commented, Sep 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrations - typeorm - GitBook
TypeORM provides a place where you can write such sql queries and run them when needed. This place is called "migrations".
Read more >
TypeORM - Migrations - Tutorialspoint
TypeORM - Migrations, Migrations are like version control for your database. It is used to modify and share application’s database schema.
Read more >
TypeORM - Amazing ORM for TypeScript and JavaScript (ES7 ...
TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, ... Migrations and automatic migrations generation.
Read more >
API with NestJS #69. Database migrations with TypeORM
We go through the idea of database migrations and learn how to perform them with TypeORM.
Read more >
Using CLI | TypeORM Docs
Automatic migration generation creates a new migration file and writes all sql queries that must be executed to update the database. If no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found