[8.x] Clarify insertOrIgnore
is not just duplicate record errors
#7308
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.
The
insertOrIgnore
method is very helpful, but it is important to understand the consequences. The method is accurately described in code as:However, the documentation describes it in the context of duplicate errors:
The statement may be interpreted as
insertOrIgnore
being equivalent to something likeskipOnDuplicate
. Unfortunately,insertOrIgnore
has a number of consequences -- depending on database engine -- such as bypassing multiple MySQL Strict-mode restrictions: it is important that it is not considered equivalent to something likeskipOnDuplicate
.The link in the warning to the MySQL documentation is without version (i.e: a link to the latest documentation) because this behaviour has been stable across multiple versions (5.7, 8.0) but we could change the link to
5.7
since that is the minimum recommended version for Laravel 8.0 -- if a link to external documentation must be pinned to a version.[1] List of errors ignored by
ignore
as of MySQL version 5.7: