()
| 65 | } |
| 66 | |
| 67 | async execute() { |
| 68 | try { |
| 69 | logger.info('Running Migrations'); |
| 70 | if (this.schemaOptions && this.schemaOptions.beforeMigration) { |
| 71 | await Promise.resolve(this.schemaOptions.beforeMigration()); |
| 72 | } |
| 73 | |
| 74 | await this.executeMigrations(); |
| 75 | |
| 76 | if (this.schemaOptions && this.schemaOptions.afterMigration) { |
| 77 | await Promise.resolve(this.schemaOptions.afterMigration()); |
| 78 | } |
| 79 | |
| 80 | logger.info('Running Migrations Completed'); |
| 81 | } catch (e) { |
| 82 | logger.error(`Failed to run migrations: ${e}`); |
| 83 | if (process.env.NODE_ENV === 'production') { process.exit(1); } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | async executeMigrations() { |
| 88 | let timeout = null; |
no test coverage detected