fix(reporters): show number of skipped migrations correctly in command output
This commit is contained in:
parent
69bd88afdb
commit
ef45be9233
4 changed files with 33 additions and 23 deletions
|
|
@ -50,7 +50,6 @@ export const migrationRunner = async <T extends MigrationMetadata | MigrationMet
|
|||
onError,
|
||||
migrationFilter = () => true,
|
||||
}: MigrationRunnerParameters<T>): Promise<Error | undefined> => {
|
||||
const collectedMigrations: Array<MigrationMetadata | MigrationMetadataFinished> = [];
|
||||
const validatedMigrations: Array<MigrationMetadata | MigrationMetadataFinished> = [];
|
||||
const migrationsToLock: MigrationMetadata[] = [];
|
||||
|
||||
|
|
@ -93,8 +92,6 @@ export const migrationRunner = async <T extends MigrationMetadata | MigrationMet
|
|||
continue;
|
||||
}
|
||||
|
||||
collectedMigrations.push(migration);
|
||||
|
||||
if (isFinishedMigration(migration)) {
|
||||
skip ||= migration.status === 'failed' || migration.status === 'skipped';
|
||||
|
||||
|
|
@ -138,7 +135,7 @@ export const migrationRunner = async <T extends MigrationMetadata | MigrationMet
|
|||
}
|
||||
}
|
||||
|
||||
await reporter.onCollectedMigrations?.(collectedMigrations);
|
||||
await reporter.onCollectedMigrations?.(validatedMigrations);
|
||||
|
||||
let optionError: Error | undefined;
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,6 @@ const getHeaderMessage = (
|
|||
|
||||
let skippedCount = 0;
|
||||
let failedCount = 0;
|
||||
let unlockableCount = 0;
|
||||
|
||||
for (const migration of migrations) {
|
||||
const isLocked = lockedMigrations.some((lockedMigration) => lockedMigration.name === migration.name);
|
||||
|
|
@ -284,8 +283,6 @@ const getHeaderMessage = (
|
|||
failedCount += 1;
|
||||
} else if (migration.status === 'skipped') {
|
||||
skippedCount += 1;
|
||||
} else {
|
||||
unlockableCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -293,7 +290,6 @@ const getHeaderMessage = (
|
|||
const parts = [
|
||||
bold(`${lockedMigrations.length} of ${migrations.length}`),
|
||||
dim(statusText),
|
||||
unlockableCount > 0 ? yellow(`(${unlockableCount} locked)`) : '',
|
||||
skippedCount > 0 ? yellowBright(`(${skippedCount} skipped)`) : '',
|
||||
failedCount > 0 ? redBright(`(${failedCount} failed)`) : '',
|
||||
].filter(Boolean);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue