Skip to content

Commit

Permalink
fix(migrations): allow running migrations outside of main transaction
Browse files Browse the repository at this point in the history
Closes #4775
  • Loading branch information
B4nan committed Oct 2, 2023
1 parent 069b495 commit e0dfb0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/src/commands/MigrationCommandFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export class MigrationCommandFactory {
}

static async handleMigrationCommand(args: ArgumentsCamelCase<Options>, method: MigratorMethod): Promise<void> {
const options = { pool: { min: 1, max: 1 } } as Partial<MikroORMOptions>;
// to be able to run have a master transaction, but run marked migrations outside of it, we need a second connection
const options = { pool: { min: 1, max: 2 } } as Partial<MikroORMOptions>;
const orm = await CLIHelper.getORM(undefined, options);
const migrator = orm.getMigrator();

Expand Down

0 comments on commit e0dfb0c

Please sign in to comment.