Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Add --path option support for artisan migrate:rollback/refresh/reset fixes #13631 #15251

Merged
merged 1 commit into from
Sep 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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