Skip to content

Commit 4e7589f

Browse files
feat: show file name in which the migration failed when using the --compact-output flag (#1108)
1 parent 3231c75 commit 4e7589f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

commands/migration/_base.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,18 @@ export default abstract class MigrationsBase extends BaseCommand {
130130
break
131131

132132
case 'error':
133-
const skippedMigrations = Object.values(migrator.migratedFiles).filter(
134-
(file) => file.status === 'pending'
135-
).length
133+
const files = Object.values(migrator.migratedFiles)
134+
135+
const skippedMigrations = files?.filter(({ status }) => status === 'pending').length
136136

137137
message = `❯ Executed ${processedFiles.size} migrations, 1 error, ${skippedMigrations} skipped`
138138
this.logger.log(this.colors.red(message))
139-
this.logger.log('\n' + this.colors.red(migrator.error!.message))
139+
140+
const failedFile = files.find(({ status }) => status === 'error')
141+
if (failedFile) {
142+
this.logger.fatal(failedFile.file.name)
143+
}
144+
140145
this.exitCode = 1
141146
break
142147
}

0 commit comments

Comments
 (0)