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.4] fix using --database option in the migrate command #17574

Merged
merged 1 commit into from
Jan 26, 2017
Merged

[5.4] fix using --database option in the migrate command #17574

merged 1 commit into from
Jan 26, 2017

Conversation

themsaid
Copy link
Member

This line already existed in 5.3, we need it to instruct the resolver to use the given connection when running the migration, the resolveConnection() method is used only when the grammar supports schema transactions:

protected function runMigration($migration, $method)
{
    $connection = $this->resolveConnection(
        $migration->getConnection()
    );

    $callback = function () use ($migration, $method) {
        $migration->{$method}();
    };

    $this->getSchemaGrammar($connection)->supportsSchemaTransactions()
                ? $connection->transaction($callback)
                : $callback();
}

In case it doesn't, we need to instruct the connection resolver to use the given connection.

@taylorotwell taylorotwell merged commit 1d81add into laravel:5.4 Jan 26, 2017
@taylorotwell
Copy link
Member

Merging for now but can you explain a bit more. To me when I was reviewing the code it felt really strange to set the default connection for the remainder of the process.

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.

2 participants