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 = (
|
const getHeaderMessage = (
|
||||||
|
command: ReporterInitParameters['command'],
|
||||||
migrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
migrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
||||||
lockedMigrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
lockedMigrations?: Array<MigrationMetadata | MigrationMetadataFinished>,
|
||||||
) => {
|
) => {
|
||||||
|
|
@ -246,7 +247,7 @@ const getHeaderMessage = (
|
||||||
const failedMigrations = nonLockedMigrations.filter(
|
const failedMigrations = nonLockedMigrations.filter(
|
||||||
(migration) => 'status' in migration && migration.status === 'failed',
|
(migration) => 'status' in migration && migration.status === 'failed',
|
||||||
);
|
);
|
||||||
const unlockableCount = nonLockedMigrations.length - failedMigrations.length;
|
const unlockableCount = command === 'up' ? nonLockedMigrations.length - failedMigrations.length : 0;
|
||||||
|
|
||||||
const parts = [
|
const parts = [
|
||||||
bold(`${lockedMigrations.length} of ${migrations.length}`),
|
bold(`${lockedMigrations.length} of ${migrations.length}`),
|
||||||
|
|
@ -340,7 +341,7 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
|
||||||
#render(flush = false): void {
|
#render(flush = false): void {
|
||||||
const parts = [
|
const parts = [
|
||||||
getTitle(this.#parameters),
|
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') ?? '',
|
this.#migrations?.map((migration) => getMigrationText(migration, this.#activeMigration)).join('\n') ?? '',
|
||||||
getSummary(this.#parameters.command, this.#migrations),
|
getSummary(this.#parameters.command, this.#migrations),
|
||||||
getError(this.#error),
|
getError(this.#error),
|
||||||
|
|
@ -394,7 +395,7 @@ class DefaultReporter implements Required<EmigrateReporter> {
|
||||||
onLockedMigrations(migrations: MigrationMetadata[]): void | PromiseLike<void> {
|
onLockedMigrations(migrations: MigrationMetadata[]): void | PromiseLike<void> {
|
||||||
this.#lockedMigrations = migrations;
|
this.#lockedMigrations = migrations;
|
||||||
|
|
||||||
console.log(getHeaderMessage(this.#migrations, this.#lockedMigrations));
|
console.log(getHeaderMessage(this.#parameters.command, this.#migrations, this.#lockedMigrations));
|
||||||
console.log('');
|
console.log('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue