-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5f6ea7
commit e37cc87
Showing
24 changed files
with
279 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Oak\Migration\Console; | ||
|
||
use Oak\Console\Command\Command; | ||
use Oak\Console\Command\Option; | ||
use Oak\Console\Command\Signature; | ||
use Oak\Contracts\Console\InputInterface; | ||
use Oak\Contracts\Console\OutputInterface; | ||
use Oak\Contracts\Container\ContainerInterface; | ||
use Oak\Migration\MigrationManager; | ||
|
||
class DowndateCommand extends Command | ||
{ | ||
/** | ||
* @var MigrationManager $manager | ||
*/ | ||
private $manager; | ||
|
||
/** | ||
* MigrationManagerCommand constructor. | ||
* @param MigrationManager $manager | ||
* @param ContainerInterface $app | ||
*/ | ||
public function __construct(MigrationManager $manager, ContainerInterface $app) | ||
{ | ||
$this->manager = $manager; | ||
parent::__construct($app); | ||
} | ||
|
||
protected function createSignature(Signature $signature): Signature | ||
{ | ||
return $signature | ||
->setName('downdate') | ||
->addOption( | ||
Option::create('migrator', 'm') | ||
->setDescription('Specify a specific migrator') | ||
) | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
foreach ($this->manager->getMigrators() as $migrator) { | ||
|
||
if ( | ||
! ($migratorName = $input->getOption('migrator')) || | ||
$migrator->getName() === $migratorName | ||
) { | ||
$migrator->downdate(); | ||
|
||
if ($migratorName) { | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Oak\Migration\Console; | ||
|
||
use Oak\Console\Command\Command; | ||
use Oak\Console\Command\Option; | ||
use Oak\Console\Command\Signature; | ||
use Oak\Contracts\Console\InputInterface; | ||
use Oak\Contracts\Console\OutputInterface; | ||
use Oak\Contracts\Container\ContainerInterface; | ||
use Oak\Migration\MigrationManager; | ||
|
||
class MigrateCommand extends Command | ||
{ | ||
/** | ||
* @var MigrationManager $manager | ||
*/ | ||
private $manager; | ||
|
||
/** | ||
* MigrationManagerCommand constructor. | ||
* @param MigrationManager $manager | ||
* @param ContainerInterface $app | ||
*/ | ||
public function __construct(MigrationManager $manager, ContainerInterface $app) | ||
{ | ||
$this->manager = $manager; | ||
parent::__construct($app); | ||
} | ||
|
||
protected function createSignature(Signature $signature): Signature | ||
{ | ||
return $signature | ||
->setName('migrate') | ||
->addOption( | ||
Option::create('migrator', 'm') | ||
->setDescription('Specify a specific migrator') | ||
) | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
foreach ($this->manager->getMigrators() as $migrator) { | ||
|
||
if ( | ||
! ($migratorName = $input->getOption('migrator')) || | ||
$migrator->getName() === $migratorName | ||
) { | ||
$migrator->migrate(); | ||
|
||
if ($migratorName) { | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.