Skip to content

Commit 9bd1b42

Browse files
committed
Get the current version
1 parent 01e4c86 commit 9bd1b42

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

scripts/migrate

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ require_once($autoload);
1313

1414
use Symfony\Component\Console\Application;
1515

16-
$application = new Application('Migrate Script by JG', '1.1.0');
16+
$application = new Application('Migrate Script by JG', '1.1.1');
1717
$application->add(new \ByJG\DbMigration\Console\ResetCommand());
1818
$application->add(new \ByJG\DbMigration\Console\UpCommand());
1919
$application->add(new \ByJG\DbMigration\Console\DownCommand());
2020
$application->add(new \ByJG\DbMigration\Console\CreateCommand());
21+
$application->add(new \ByJG\DbMigration\Console\DatabaseVersionCommand());
2122
$application->run();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: jg
5+
* Date: 17/06/16
6+
* Time: 21:52
7+
*/
8+
9+
namespace ByJG\DbMigration\Console;
10+
11+
use Symfony\Component\Console\Input\InputInterface;
12+
use Symfony\Component\Console\Output\OutputInterface;
13+
14+
class DatabaseVersionCommand extends ConsoleCommand
15+
{
16+
protected function configure()
17+
{
18+
parent::configure();
19+
$this
20+
->setName('version')
21+
->setDescription('Get the current database version');
22+
23+
}
24+
25+
protected function execute(InputInterface $input, OutputInterface $output)
26+
{
27+
parent::execute($input, $output);
28+
$output->writeln('version: ' . $this->migration->getCurrentVersion());
29+
}
30+
}

0 commit comments

Comments
 (0)