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

[9.x] Fixes usage of Migrator without output #43326

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

nunomaduro
Copy link
Member

This pull request fixes an issue on the Migrator that may not run pending migrations if there is no Output instance on the class itself. This was a bug introduced at #43065, as the given closure only runs if there is an Output:

        $this->write(Task::class, $name, fn () => $this->runMigration($migration, 'up'));
        
     // ...

    protected function write($component, ...$arguments)
    {
        if ($this->output) {
            with(new $component($this->output))->render(...$arguments);
        }
    }

This pull requests addresses this issue, by giving a null output to the Task component, ensuring this way that the given task always run:

    protected function write($component, ...$arguments)
    {
        with(new $component(
            $this->output ?: new NullOutput()
        ))->render(...$arguments);
    }

Fixes #43325.

@nunomaduro nunomaduro requested a review from taylorotwell July 20, 2022 17:55
@taylorotwell taylorotwell merged commit bcf35ad into 9.x Jul 20, 2022
@taylorotwell taylorotwell deleted the fix/migrator-without-output branch July 20, 2022 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[9.x] Custom database migration in 9.21.0 does not work like it did in 9.20.0
2 participants