-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathStatusCommand.php
More file actions
58 lines (49 loc) · 1.49 KB
/
StatusCommand.php
File metadata and controls
58 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Created by PhpStorm.
* User: aguidet
* Date: 28/02/15
* Time: 18:14
*/
namespace Migrate\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class StatusCommand extends AbstractEnvCommand
{
protected function configure()
{
$this
->setName('migrate:status')
->setDescription('Display the current status of the specified environment')
->addArgument(
'env',
InputArgument::REQUIRED,
'Environment'
)->addOption(
'database',
null,
InputOption::VALUE_REQUIRED,
'Database '
)->addOption(
'driver',
null,
InputOption::VALUE_REQUIRED,
'DB driver'
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->init($input, $output);
$table = new Table($output);
$table->setHeaders(array('id', 'version', 'applied at', 'description'));
$migrations = $this->getRemoteAndLocalMigrations();
/* @var $migration Migration */
foreach ($migrations as $migration) {
$table->addRow($migration->toArray());
}
$table->render();
}
}