Skip to content

Commit

Permalink
Added path support for artisan migrate:rollback/refresh/reset fixes l…
Browse files Browse the repository at this point in the history
…aravel#13631

Added path support for artisan migrate:rollback/refresh/reset fixed laravel#13631

Add --path support to ResetCommand and RefreshCommand

Add --path to refresh command test.

Update refresh command test.
  • Loading branch information
anderly committed Sep 6, 2016
1 parent 2992315 commit 665ab29
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Console/Migrations/RefreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function fire()

if ($step > 0) {
$this->call('migrate:rollback', [
'--database' => $database, '--force' => $force, '--step' => $step,
'--database' => $database, '--force' => $force, '--path' => $path, '--step' => $step,
]);
} else {
$this->call('migrate:reset', [
'--database' => $database, '--force' => $force,
'--database' => $database, '--force' => $force, '--path' => $path,
]);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Database/Console/Migrations/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ protected function getOptions()

['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],

['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'],

['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ protected function getOptions()

['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],

['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'],

['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'],

['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted.'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseMigrationRefreshCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testRefreshCommandCallsCommandsWithProperArguments()
$console->shouldReceive('find')->with('migrate:reset')->andReturn($resetCommand);
$console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);

$resetCommand->shouldReceive('run')->with(new InputMatcher("--database --force 'migrate:reset'"), m::any());
$resetCommand->shouldReceive('run')->with(new InputMatcher("--database --force --path 'migrate:reset'"), m::any());
$migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --force --path migrate'), m::any());

$this->runCommand($command);
Expand All @@ -54,7 +54,7 @@ public function testRefreshCommandCallsCommandsWithStep()
$console->shouldReceive('find')->with('migrate:rollback')->andReturn($rollbackCommand);
$console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);

$rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --force --step=2 'migrate:rollback'"), m::any());
$rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --force --path --step=2 'migrate:rollback'"), m::any());
$migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --force --path migrate'), m::any());

$this->runCommand($command, ['--step' => 2]);
Expand Down

0 comments on commit 665ab29

Please sign in to comment.