Skip to content

Commit

Permalink
Get the current version
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed May 9, 2017
1 parent 01e4c86 commit 9bd1b42
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/migrate
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ require_once($autoload);

use Symfony\Component\Console\Application;

$application = new Application('Migrate Script by JG', '1.1.0');
$application = new Application('Migrate Script by JG', '1.1.1');
$application->add(new \ByJG\DbMigration\Console\ResetCommand());
$application->add(new \ByJG\DbMigration\Console\UpCommand());
$application->add(new \ByJG\DbMigration\Console\DownCommand());
$application->add(new \ByJG\DbMigration\Console\CreateCommand());
$application->add(new \ByJG\DbMigration\Console\DatabaseVersionCommand());
$application->run();
30 changes: 30 additions & 0 deletions src/Console/DatabaseVersionCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Created by PhpStorm.
* User: jg
* Date: 17/06/16
* Time: 21:52
*/

namespace ByJG\DbMigration\Console;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DatabaseVersionCommand extends ConsoleCommand
{
protected function configure()
{
parent::configure();
$this
->setName('version')
->setDescription('Get the current database version');

}

protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);
$output->writeln('version: ' . $this->migration->getCurrentVersion());
}
}

0 comments on commit 9bd1b42

Please sign in to comment.