-
Notifications
You must be signed in to change notification settings - Fork 11k
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] Apply limit to database rather than collection #30148
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For HasInDatabase.php
driesvints
changed the title
Apply limit to database rather than collection
[6.x] Apply limit to database rather than collection
Sep 30, 2019
The same code is used in |
@staudenmeir done, thanks! |
Gman98ish
added a commit
to Gman98ish/framework
that referenced
this pull request
Oct 4, 2019
Remove brackets arround URL php artisan serve (laravel#30168) To allow opening the development URL in Visual Studio Code with ctrl + click the bracket after the URL needs to be removed. This patch wil remove the brackets around the url. add test for sorted middlewares (laravel#30166) [6.x] Apply limit to database rather than collection (laravel#30148) * Apply limit to database rather than collection For HasInDatabase.php * Fix tests * Add to SoftDeleted trait as well * Update HasInDatabase.php * Update SoftDeletedInDatabase.php [6.x] Allow to use scoped macro in nested queries (laravel#30127) * Allow to use scoped macro in nested queries. * Use newQueryWithoutRelationships
Gman98ish
added a commit
to Gman98ish/framework
that referenced
this pull request
Oct 4, 2019
Remove brackets arround URL php artisan serve (laravel#30168) To allow opening the development URL in Visual Studio Code with ctrl + click the bracket after the URL needs to be removed. This patch wil remove the brackets around the url. add test for sorted middlewares (laravel#30166) [6.x] Apply limit to database rather than collection (laravel#30148) * Apply limit to database rather than collection For HasInDatabase.php * Fix tests * Add to SoftDeleted trait as well * Update HasInDatabase.php * Update SoftDeletedInDatabase.php [6.x] Allow to use scoped macro in nested queries (laravel#30127) * Allow to use scoped macro in nested queries. * Use newQueryWithoutRelationships
i-bajrai
pushed a commit
to i-bajrai/framework
that referenced
this pull request
Oct 4, 2019
* Apply limit to database rather than collection For HasInDatabase.php * Fix tests * Add to SoftDeleted trait as well * Update HasInDatabase.php * Update SoftDeletedInDatabase.php
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From #30144 with fixed tests
If the following conditions are true:
DatabaseTransactions
rather thanRefreshDatabase
;assertDatabaseHas
assertion is being used; andThe entire table is put into memory causing allowed memory fatal errors.
This is because the
limit
is applied on aCollection
after putting all the records in memory.This change puts the
limit
on the database query so only the limited amount of records go into memory.This avoids errors in tests for users and does not break any existing features.