Deprecate Index features and introduce IndexEditor #6886
Merged
morozov merged 4 commits intodoctrine:4.3.xfrom Apr 5, 2025
Merged
Deprecate Index features and introduce IndexEditor #6886morozov merged 4 commits intodoctrine:4.3.xfrom
morozov merged 4 commits intodoctrine:4.3.xfrom
Conversation
morozov
commented
Apr 3, 2025
| { | ||
| if ($length !== null && $length <= 0) { | ||
| throw InvalidIndexDefinition::fromNonPositiveColumnLength($length); | ||
| } |
Member
Author
There was a problem hiding this comment.
This is not a breaking change. Index will catch this exception and turn into a deprecation notice. An InvalidState exception will be thrown only upon attempt to access the indexed columns via the new API:
dbal/tests/Schema/IndexTest.php
Lines 255 to 264 in feed861
0cac859 to
cd00543
Compare
greg0ire
reviewed
Apr 4, 2025
cd00543 to
386959b
Compare
greg0ire
approved these changes
Apr 5, 2025
This file contains hidden or 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
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.
This is a continuation of the rework started in #6685 (unique constraints) and #6728 (foreign key constraints), now applied to indexes. See the upgrade notes for details on the end-user impact.
Deprecation details
The
Index#overrules()method is currently used by the ORM'sSchemaTool(source). It should be easy to replace with a check if the the index columns are the same or a prefix of the PK columns. All other logic ofoverrules()(checking for the index type and the details of the partial index) is irrelevant in this case. I don't really understand howIndex#overrules()is different fromIndex#isFulfilledBy()(besides the fact that it means the opposite).Index#isFulfilledBy()will be available for now, but as soon as we get rid of implicit indexes (not very soon), it will become irrelevant to the DBAL. At that point, the ORM will be a more appropriate place for it.