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

[11.x] Fix: Apply database connection before checking if the repository exist #51021

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

sjspereira
Copy link
Contributor

  • Issue

There is an issue when running the command "php artisan migrate:fresh --database=someconnection".

When the command is ran providing the connection the tables are never being dropped.

So investigating the issue, we notice that the given connection isn't considered in the $this->migrator->repositoryExists() method.

To fix it was added the setConnection method as below:

if(! is_null($database)) {
    $this->migrator->setConnection($database);
}

OBS: The issue occurs when you specify a connection different than the default.

Thanks for @GabsCoding, that discovered this issue with me.

@sjspereira sjspereira changed the title Fix: Apply database connection before checking if the repository exist [11.x] Fix: Apply database connection before checking if the repository exist Apr 11, 2024
@taylorotwell taylorotwell merged commit dec31b0 into laravel:11.x Apr 11, 2024
28 checks passed
@driesvints
Copy link
Member

We had to do a small fix here for resetting the connection: #51167

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.

None yet

3 participants