fix(list): don't log info about locked migrations as it doesn't happen in this command
This commit is contained in:
parent
bc33e63e3e
commit
5307e87242
2 changed files with 10 additions and 3 deletions
6
.changeset/seven-dolls-hug.md
Normal file
6
.changeset/seven-dolls-hug.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@emigrate/cli': patch
|
||||
'@emigrate/reporter-pino': patch
|
||||
---
|
||||
|
||||
Only log info about locked migrations in the "up" command, as "list" doesn't do any locking
|
||||
|
|
@ -225,6 +225,7 @@ const getSummary = (
|
|||
};
|
||||
|
||||
const getHeaderMessage = (
|
||||
command: ReporterInitParameters['command'],
|
||||
migrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
||||
lockedMigrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
||||
) => {
|
||||
|
|
@ -246,7 +247,7 @@ const getHeaderMessage = (
|
|||
const failedMigrations = nonLockedMigrations.filter(
|
||||
(migration) => 'status' in migration && migration.status === 'failed',
|
||||
);
|
||||
const unlockableCount = nonLockedMigrations.length - failedMigrations.length;
|
||||
const unlockableCount = command === 'up' ? nonLockedMigrations.length - failedMigrations.length : 0;
|
||||
|
||||
const parts = [
|
||||
bold(`${lockedMigrations.length} of ${migrations.length}`),
|
||||
|
|
@ -340,7 +341,7 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
|
|||
#render(flush = false): void {
|
||||
const parts = [
|
||||
getTitle(this.#parameters),
|
||||
getHeaderMessage(this.#migrations, this.#lockedMigrations),
|
||||
getHeaderMessage(this.#parameters.command, this.#migrations, this.#lockedMigrations),
|
||||
this.#migrations?.map((migration) => getMigrationText(migration, this.#activeMigration)).join('\n') ?? '',
|
||||
getSummary(this.#parameters.command, this.#migrations),
|
||||
getError(this.#error),
|
||||
|
|
@ -394,7 +395,7 @@ class DefaultReporter implements Required<EmigrateReporter> {
|
|||
onLockedMigrations(migrations: MigrationMetadata[]): void | PromiseLike<void> {
|
||||
this.#lockedMigrations = migrations;
|
||||
|
||||
console.log(getHeaderMessage(this.#migrations, this.#lockedMigrations));
|
||||
console.log(getHeaderMessage(this.#parameters.command, this.#migrations, this.#lockedMigrations));
|
||||
console.log('');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue