fix(pino): show correct statuses for the "list" and "new" commands
This commit is contained in:
parent
17feb2d2c2
commit
1065322435
2 changed files with 21 additions and 2 deletions
5
.changeset/tender-timers-remember.md
Normal file
5
.changeset/tender-timers-remember.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@emigrate/reporter-pino': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Show correct status for migrations for the "list" and "new" commands
|
||||||
|
|
@ -116,12 +116,26 @@ class PinoReporter implements Required<EmigrateReporter> {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMigrationStart(migration: MigrationMetadata): Awaitable<void> {
|
onMigrationStart(migration: MigrationMetadata): Awaitable<void> {
|
||||||
const status = this.#command === 'up' ? 'running' : 'removing';
|
let status = 'running';
|
||||||
|
|
||||||
|
if (this.#command === 'remove') {
|
||||||
|
status = 'removing';
|
||||||
|
} else if (this.#command === 'new') {
|
||||||
|
status = 'creating';
|
||||||
|
}
|
||||||
|
|
||||||
this.#logger.info({ migration: migration.relativeFilePath }, `${migration.name} (${status})`);
|
this.#logger.info({ migration: migration.relativeFilePath }, `${migration.name} (${status})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMigrationSuccess(migration: MigrationMetadataFinished): Awaitable<void> {
|
onMigrationSuccess(migration: MigrationMetadataFinished): Awaitable<void> {
|
||||||
const status = this.#command === 'up' ? 'done' : 'removed';
|
let status = 'done';
|
||||||
|
|
||||||
|
if (this.#command === 'remove') {
|
||||||
|
status = 'removed';
|
||||||
|
} else if (this.#command === 'new') {
|
||||||
|
status = 'created';
|
||||||
|
}
|
||||||
|
|
||||||
this.#logger.info({ migration: migration.relativeFilePath }, `${migration.name} (${status})`);
|
this.#logger.info({ migration: migration.relativeFilePath }, `${migration.name} (${status})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue