1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* This file is part of the daikon-cqrs/boot project. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Daikon\Boot\Console\Command\Migrate; |
10
|
|
|
|
11
|
|
|
use Daikon\Dbal\Migration\MigrationTargetMap; |
12
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
13
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
14
|
|
|
use Symfony\Component\Console\Input\InputOption; |
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
16
|
|
|
|
17
|
|
|
final class ListTargets extends Command |
18
|
|
|
{ |
19
|
|
|
private MigrationTargetMap $migrationTargetMap; |
20
|
|
|
|
21
|
|
|
public function __construct(MigrationTargetMap $migrationTargetMap) |
22
|
|
|
{ |
23
|
|
|
$this->migrationTargetMap = $migrationTargetMap; |
24
|
|
|
|
25
|
|
|
parent::__construct(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
protected function configure(): void |
29
|
|
|
{ |
30
|
|
|
$this |
31
|
|
|
->setName('migrate:ls') |
32
|
|
|
->setDescription('Lists available migration targets.') |
33
|
|
|
->addOption( |
34
|
|
|
'target', |
35
|
|
|
null, |
36
|
|
|
InputOption::VALUE_REQUIRED, |
37
|
|
|
'Name of the target to list.' |
38
|
|
|
); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int |
42
|
|
|
{ |
43
|
|
|
$target = $input->getOption('target'); |
44
|
|
|
foreach ($this->migrationTargetMap as $targetKey => $migrationTarget) { |
45
|
|
|
if ($target && $target !== $targetKey) { |
46
|
|
|
continue; |
47
|
|
|
} |
48
|
|
|
$migrationList = $migrationTarget->getMigrationList(); |
49
|
|
|
$executedMigrations = $migrationList->getExecutedMigrations(); |
50
|
|
|
$pendingMigrations = $migrationList->getPendingMigrations(); |
51
|
|
|
$output->writeln('Summary for migration target <options=bold>'.$targetKey.'</>'); |
52
|
|
|
$output->writeln(' Enabled: '.($migrationTarget->isEnabled() ? 'true' : 'false')); |
53
|
|
|
$output->writeln(' Executed Migrations: '.count($executedMigrations)); |
54
|
|
|
$output->writeln(' Pending Migrations: '.count($pendingMigrations)); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return 0; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths