Skip to content

Commit

Permalink
Merge pull request #4615 from neos/90/feature/list-nodemigrations-com…
Browse files Browse the repository at this point in the history
…mand

FEATURE: Add nodemigrations command to list all available node migration
  • Loading branch information
ahaeslich authored Oct 13, 2023
2 parents e7b9543 + 79d7863 commit f51830a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,37 @@ public function kickstartCommand(string $packageKey): void
$this->outputLine('Your node migration has been created successfully.');
}

/**
* List available migrations
*
* @see neos.contentrepositoryregistry:nodemigration:list
*/
public function listCommand(): void
{
$availableMigrations = $this->migrationFactory->getAvailableVersions();
if (count($availableMigrations) === 0) {
$this->outputLine('No migrations available.');
$this->quit();
}

$tableRows = [];
foreach ($availableMigrations as $version => $migration) {
$migrationUpConfigurationComments = $this->migrationFactory->getMigrationForVersion($version)->getComments();

$tableRows[] = [
$version,
$migration['formattedVersionNumber'],
$migration['package']->getPackageKey(),

wordwrap($migrationUpConfigurationComments, 60)
];
}

$this->outputLine('<b>Available migrations</b>');
$this->outputLine();
$this->output->outputTable($tableRows, ['Version', 'Date', 'Package', 'Comments']);
}

/**
* Helper to output comments and warnings for the given configuration.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Neos\ContentRepositoryRegistry\Migration\Factory;

/*
Expand Down Expand Up @@ -31,4 +32,9 @@ public function getMigrationForVersion($version): MigrationConfiguration
{
return new MigrationConfiguration($this->migrationConfiguration->getMigrationVersion($version));
}

public function getAvailableVersions(): array
{
return $this->migrationConfiguration->getAvailableVersions();
}
}

0 comments on commit f51830a

Please sign in to comment.