-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[12.x] Fix accessing Connection
property in Grammar
classes
#54487
[12.x] Fix accessing Connection
property in Grammar
classes
#54487
Conversation
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
I've implemented passing Moving the |
@tpetry Thank you for reviewing and dislike😅. But this PR isn't just a styling fix, accessing the
|
@tpetry any further comments based on above? 👆 |
Not a big fan, but the package authors will find a way to make it work with the bc break here. And with the blueprint changes already merged (which I didn't see at that time) it'll already be some work. So break more stuff if it really simplifies some stuff in the future. |
The
Illuminate\Database\Grammar
class has required aConnection $connection
property since Laravel 10.x (via #46558), but it was passed viasetConnection()
method to avoid signature changes in a patch release. Since then, many methods in theGrammar
classes have needed access to theConnection
property (mainly to retrieve config properties and compare driver versions). This PR does:Connection $connection
to theGrammar
constructor, instead of callingsetConnection()
when instantiating.Connection::getTablePrefix()
instead of having the$prefix
property in theGrammar
andBlueprint
classes.P.S. 1: This PR doesn’t require any upgrade guide for end-users.
P.S. 2: The
$connection
property was added to theBlueprint
constructor in Laravel 12.x via #51821, so now is a good time to fix it in theGrammar
class as well.Summary
prefix_indexes
config property tosqlite
connection to be consistent with other DB driver connections.Connection $connection
property toIlluminate/Database/Grammar::__construct()
method.Illuminate\Database\Connection::withTablePrefix()
method.Illuminate\Database\Grammar::setConnection()
method.Illuminate\Database\Schema\Builder::setConnection()
method.$prefix
property fromIlluminate\Database\Schema\Blueprint::__construct()
method.Illuminate\Database\Grammar::getTablePrefix()
method (UseIlluminate\Database\Connection::getTablePrefix()
instead).Illuminate\Database\Grammar::setTablePrefix()
method (UseIlluminate\Database\Connection::setTablePrefix()
instead).Illuminate\Database\Schema\Blueprint::getPrefix()
method (UseIlluminate\Database\Connection::getTablePrefix()
instead).Blueprint
whenprefix_indexes
is set tofalse
.createDatabase()
anddropDatabaseIfExists()
methods toIlluminate\Database\Schema\Builder
parent class (The same method was overridden on all inherited classes.)