(method: 'up' | 'down', afterRun?: (tx?: Transaction) => Promise<void>)
| 452 | |
| 453 | protected resolve(params: { name: string; path: string }): RunnableMigration { |
| 454 | const createMigrationHandler = async (method: 'up' | 'down', afterRun?: (tx?: Transaction) => Promise<void>) => { |
| 455 | const { fs } = await import('@mikro-orm/core/fs-utils'); |
| 456 | const migration = await fs.dynamicImport(params.path); |
| 457 | const MigrationClass = Object.values(migration).find( |
| 458 | cls => typeof cls === 'function' && typeof cls.constructor === 'function', |
| 459 | ) as Constructor<Migration>; |
| 460 | const instance = new MigrationClass(this.driver, this.config); |
| 461 | |
| 462 | await this.runner.run(instance, method, afterRun); |
| 463 | }; |
| 464 | |
| 465 | return { |
| 466 | name: this.storage.getMigrationName(params.name), |
no test coverage detected