(
method: 'up' | 'down',
options?: string | string[] | MigrateOptions,
)
| 713 | } |
| 714 | |
| 715 | protected async runMigrations( |
| 716 | method: 'up' | 'down', |
| 717 | options?: string | string[] | MigrateOptions, |
| 718 | ): Promise<MigrationInfo[]> { |
| 719 | await this.init(); |
| 720 | const normalized = this.prefix(options); |
| 721 | this.runner.setRunSchema?.(normalized.schema); |
| 722 | this.storage.setRunSchema?.(normalized.schema); |
| 723 | |
| 724 | try { |
| 725 | if (!this.options.transactional || !this.options.allOrNothing) { |
| 726 | return await this.executeMigrations(method, normalized); |
| 727 | } |
| 728 | |
| 729 | if (Utils.isObject<MigrateOptions>(options) && options.transaction) { |
| 730 | return await this.runInTransaction(options.transaction, method, normalized); |
| 731 | } |
| 732 | |
| 733 | return await this.driver.getConnection().transactional(trx => this.runInTransaction(trx, method, normalized)); |
| 734 | } finally { |
| 735 | this.runner.unsetRunSchema?.(); |
| 736 | this.storage.unsetRunSchema?.(); |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | private async runInTransaction(trx: Transaction, method: 'up' | 'down', options: NormalizedMigrateOptions) { |
| 741 | this.runner.setMasterMigration(trx); |
nothing calls this directly
no test coverage detected