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

[6.x] Error out when detecting incompatible DBAL version #38543

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Aug 25, 2021

doctrine/dbal is an optional dependency of laravel/framework, and v3 of
the DBAL has been released recently, but obviously, Laravel 6 was never
meant to be compatible with that version.
Users still using Laravel 6 and updating their dependencies get confused
and file invalid reports on the DBAL, see for instance
doctrine/dbal#4439
or
doctrine/dbal#4757

Fixes #24271

@GrahamCampbell
Copy link
Member

👎 from me here. People can install doctrine 3 and not use that part of laravel, so the conflict is artifical. Also, composer will just load an older version of Laravel 6 to get around this. It would be bad for people to miss security update because this conflict stopped them from being installed.

@driesvints
Copy link
Member

Hey @greg0ire, as @GrahamCampbell indicates, people could still be using Doctrine v3 in situations other than just the column changing functionality of the migrations. I think we should thread carefully here and not force people to only use Doctrine v2.

@greg0ire
Copy link
Contributor Author

@GrahamCampbell good point, I hadn't consider the case of people deliberately using DBAL 3, but not through Laravel. The right thing to do would probably to error out in src/Illuminate/Database/*Connection.php then, as proposed in #24271 , right?

@driesvints
Copy link
Member

@greg0ire a more expressive exception when Doctrine v3 is used is definitely an option yes. Good call.

@greg0ire greg0ire marked this pull request as draft August 25, 2021 19:17
@greg0ire greg0ire changed the title Add conflict with doctrine/dbal 3 Error out when detecting incompatible DBAL version Aug 25, 2021
@greg0ire
Copy link
Contributor Author

I pushed a new commit doing just that, please review and then I will do the same for other connection classes 🙂

@@ -85,6 +86,12 @@ protected function getDefaultPostProcessor()
*/
protected function getDoctrineDriver()
{
if (! class_exists(DoctrineDriver::class)) {
throw new LogicException(
'Laravel v6 is only compatible with doctrine/dbal 2, lock it to that version with composer require doctrine/dbal "^2.0"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe In order to use this feature you must require the package "doctrine/dba:^2.6".?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure 👍

@driesvints
Copy link
Member

@greg0ire that definitely looks good to me. Just want to remind you that Taylor needs to approve this and he only reviews non-draft PR's. So feel free to add it to the other connections and mark this as ready for review.

Thanks for sending this in 🙂

@greg0ire
Copy link
Contributor Author

greg0ire commented Aug 25, 2021

Yes, I marked as draft to avoid a merge before I had a chance to do the same for other connections 😛

doctrine/dbal is an optional dependency of laravel/framework, and v3 of
the DBAL has been released recently, but obviously, Laravel 6 was never
meant to be compatible with that version.
Users still using Laravel 6 and updating their dependencies get confused
and file invalid reports on the DBAL, see for instance
doctrine/dbal#4439
or
doctrine/dbal#4757

Fixes laravel#24271
@greg0ire greg0ire marked this pull request as ready for review August 25, 2021 19:29
@taylorotwell taylorotwell merged commit 1fca1c1 into laravel:6.x Aug 26, 2021
@GrahamCampbell GrahamCampbell changed the title Error out when detecting incompatible DBAL version [6.x] Error out when detecting incompatible DBAL version Aug 26, 2021
@greg0ire greg0ire deleted the conflict-with-dbal-v3 branch August 26, 2021 14:47
victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
doctrine/dbal is an optional dependency of laravel/framework, and v3 of
the DBAL has been released recently, but obviously, Laravel 6 was never
meant to be compatible with that version.
Users still using Laravel 6 and updating their dependencies get confused
and file invalid reports on the DBAL, see for instance
doctrine/dbal#4439
or
doctrine/dbal#4757

Fixes laravel#24271
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.

4 participants