Skip to content
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

Simplify tracking implicitly created indexes #6550

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

morozov
Copy link
Member

@morozov morozov commented Oct 14, 2024

Q A
Type improvement

I'm trying to clean up the codebase before reworking the logic of managing indexes in the schema.

Currently, Table::$implicitIndexes contains both the index names as keys and the indexes themselves as values. On the one hand, this is redundant (because all indexes are already contained in Table::$_indexes); on the other hand, this is confusing (it is unclear whether Table::$_indexes contains all indexes or only the explicitly created ones).

The proposed fix replaces Table::$implicitIndexes with Table::$implicitIndexNames and addresses both of the above issues.

Additionally, it introduces the PrimaryKeyAlreadyExists exception. This isn't strictly necessary here but also addresses two issues:

  1. It breaks a complex if statement that checks for the exceptional condition into two simpler ones.
  2. It makes the UX less confusing: unlike regular indexes (which must have a unique name and thus are identified by name), there can be only one primary key, so the name of the offending index in the exception message is irrelevant (furthermore, an index isn't guaranteed to have a name).

greg0ire
greg0ire previously approved these changes Oct 14, 2024
SenseException
SenseException previously approved these changes Oct 14, 2024
@morozov morozov merged commit 33f5589 into doctrine:4.3.x Oct 15, 2024
90 of 91 checks passed
@morozov morozov deleted the implicit-index-names branch October 15, 2024 23:59
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