Skip to content

[9.x] Use write connection on Schema::getColumnListing() and Schema::hasTable() for MySQL and PostgreSQL#44946

Merged
taylorotwell merged 4 commits intolaravel:9.xfrom
taka-oyama:9.x
Nov 15, 2022
Merged

[9.x] Use write connection on Schema::getColumnListing() and Schema::hasTable() for MySQL and PostgreSQL#44946
taylorotwell merged 4 commits intolaravel:9.xfrom
taka-oyama:9.x

Conversation

@taka-oyama
Copy link
Contributor

@taka-oyama taka-oyama commented Nov 15, 2022

This is a follow up PR to #25203.

That PR made it so that the Illuminate\Database\Schema\Builder would do a select on the write connection.

The change was made to prevented migrations from getting PDOException when the read connection had not received the preceding migration changes due to replication lag.

The problem with that PR was that it applied the fix towards the generic schema builder which is overridden for MySQL and PostgreSQL specific builders.

So the fix was not applied for MySQL and PostgreSQL. This PR is an attempt to fix that.

This change will not break any existing features.

@taka-oyama
Copy link
Contributor Author

taka-oyama commented Nov 15, 2022

I just realized there were no tests for this case. I will add some. -> done.

@taka-oyama taka-oyama changed the title [9.x] Use write connection on Schema::hasColumn() and Schema::hasTable() for MySQL and PostgreSQL [9.x] Use write connection on Schema::getColumnListing() and Schema::hasTable() for MySQL and PostgreSQL Nov 15, 2022
@taka-oyama
Copy link
Contributor Author

taka-oyama commented Nov 15, 2022

AWS's S3 library seems to be failing but that is unrelated to this fix.

I submitted a PR issue to aws-sdk-php to fix the failing test.

@driesvints
Copy link
Member

@taka-oyama I didn't see a PR from you, only an issue? Anyway I sent one on here: aws/aws-sdk-php#2560

@taka-oyama
Copy link
Contributor Author

taka-oyama commented Nov 15, 2022

Sorry, you're right, I meant I sent an issue. Thank you.

@taylorotwell taylorotwell merged commit 5fa9267 into laravel:9.x Nov 15, 2022
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