(migrationsDir: string, file: string)
| 89 | } |
| 90 | |
| 91 | async function runMigration(migrationsDir: string, file: string) { |
| 92 | printBoxMessage('⚡️ Running Migration ⚡️ ', [`${file}`]); |
| 93 | try { |
| 94 | const migration = await import(path.join(migrationsDir, file)); |
| 95 | await migration.up(); |
| 96 | if (!getIsDry() && !getShouldIgnoreRecord()) { |
| 97 | await db.codeMigration.upsert({ |
| 98 | where: { |
| 99 | name: file, |
| 100 | }, |
| 101 | update: { |
| 102 | name: file, |
| 103 | }, |
| 104 | create: { |
| 105 | name: file, |
| 106 | }, |
| 107 | }); |
| 108 | } |
| 109 | } catch (error) { |
| 110 | printBoxMessage('❌ Migration Failed ❌', [ |
| 111 | `Error running migration ${file}:`, |
| 112 | error, |
| 113 | ]); |
| 114 | process.exit(1); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | migrate(); |
no test coverage detected