Skip to content

Commit

Permalink
Fix migrate command
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Feb 3, 2016
1 parent a1e1989 commit 6844a02
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Console/Commands/ModuleMigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -58,18 +59,18 @@ public function __construct(Migrator $migrator, Modules $module)
*/
public function fire()
{
if (! $this->confirmToProceed()) return null;

$this->prepareDatabase();

$module = $this->module->getProperties($this->argument('slug'));
if (! empty($this->argument('slug'))) {
$module = $this->module->getProperties($this->argument('slug'));

if (! is_null($module)) {
if ($this->module->isEnabled($module['slug'])) {
return $this->migrate($module['slug']);
} elseif ($this->option('force')) {
return $this->migrate($module['slug']);
}
} else {
return $this->error('Nothing to migrate.');
}
} else {
if ($this->option('force')) {
$modules = $this->module->all();
Expand All @@ -92,7 +93,7 @@ public function fire()
protected function migrate($slug)
{
if ($this->module->exists($slug)) {
$pretend = $this->option('pretend');
$pretend = array(Arr::get($this->option(), 'pretend', false));
$path = $this->getMigrationPath($slug);

$this->migrator->run($path, $pretend);
Expand All @@ -102,7 +103,7 @@ protected function migrate($slug)
// any instances of the OutputInterface contract passed into the class.
foreach ($this->migrator->getNotes() as $note) {
if (! $this->option('quiet')) {
$this->output->writeln($note);
$this->line($note);
}
}

Expand Down

0 comments on commit 6844a02

Please sign in to comment.