mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
Fix rollback command (#14)
* Add and use setParameterDefaults() * Correct rollback test * Check ignored parameters instead of directly checking the command's options * Delete --path setting from the test * Revert test changes * Delete new lines
This commit is contained in:
parent
ab240fb675
commit
b503dbf33d
1 changed files with 19 additions and 5 deletions
|
|
@ -27,11 +27,7 @@ class Rollback extends RollbackCommand
|
|||
|
||||
public function handle(): int
|
||||
{
|
||||
foreach (config('tenancy.migration_parameters') as $parameter => $value) {
|
||||
if (! $this->input->hasParameterOption($parameter)) {
|
||||
$this->input->setOption(ltrim($parameter, '-'), $value);
|
||||
}
|
||||
}
|
||||
$this->setParameterDefaults();
|
||||
|
||||
if (! $this->confirmToProceed()) {
|
||||
return 1;
|
||||
|
|
@ -55,4 +51,22 @@ class Rollback extends RollbackCommand
|
|||
{
|
||||
return 'tenants:rollback';
|
||||
}
|
||||
|
||||
protected function setParameterDefaults(): void
|
||||
{
|
||||
// Parameters that this command doesn't support, but can be in tenancy.migration_parameters
|
||||
$ignoredParameters = [
|
||||
'--seed',
|
||||
'--seeder',
|
||||
'--isolated',
|
||||
'--schema-path',
|
||||
];
|
||||
|
||||
foreach (config('tenancy.migration_parameters') as $parameter => $value) {
|
||||
// Only set the default if the option isn't set
|
||||
if (! in_array($parameter, $ignoredParameters) && ! $this->input->hasParameterOption($parameter)) {
|
||||
$this->input->setOption(ltrim($parameter, '-'), $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue