Skip to content

[5.8] Pass down the serverVersion database connection option to Doctrine DBAL connection#28964

Merged
taylorotwell merged 1 commit intolaravel:5.8from
tonysm:fix-migration-and-serverVersion
Jun 27, 2019
Merged

[5.8] Pass down the serverVersion database connection option to Doctrine DBAL connection#28964
taylorotwell merged 1 commit intolaravel:5.8from
tonysm:fix-migration-and-serverVersion

Conversation

@tonysm
Copy link
Copy Markdown
Contributor

@tonysm tonysm commented Jun 26, 2019

I got into this issue while I was trying to run the migrations against Azure's MySQL
database. Azure's setup uses a gateway to proxy connections to the correct server,
which tricks PDO, because the gateway version is different than the actual server
that the migration runs. The server runs 5.7, while the gateway server runs a 5.6.

By using this option, we can manually pass the server version (5.7) and the correct
data types will be mapped. In my case, JSON columns were throwing an exception, even
though they are supported in the actual server.

…AL connection

I got into this issue when I was trying to run the migrations against Azure's MySQL
database. Azure's setup uses a gateway [1] to proxy connections to the correct server,
which tricks PDO, because the gateway version is different than the actual server
that the migration runs is 5.7, while the gateway server runs a 5.6.

By using this option, we can manually pass the server version (5.7) and the correct
data types will be mapped. In my case, JSON columns were throwing exception, even
though they are supported in the actual server [2].

References:

[1](https://docs.microsoft.com/en-us/azure/mysql/concepts-supported-versions)
[2](https://www.doctrine-project.org/projects/doctrine-dbal/en/2.9/reference/configuration.html#automatic-platform-version-detection)
@tonysm tonysm changed the title Pass down the serverVersion database connection option to Doctrine DBAL connection [5.8] Pass down the serverVersion database connection option to Doctrine DBAL connection Jun 26, 2019
@tonysm
Copy link
Copy Markdown
Contributor Author

tonysm commented Jun 26, 2019

Would love to get this on Laravel 5.7.x as well, how can I make it? Should I send another PR to 5.7?

@taylorotwell taylorotwell merged commit 8de4eb9 into laravel:5.8 Jun 27, 2019
@driesvints
Copy link
Copy Markdown
Member

@tonysm 5.7 isn't supported anymore unfortunately: https://laravel.com/docs/5.8/releases#support-policy

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.

3 participants