-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Allow overriding implicit indexes #769
Allow overriding implicit indexes #769
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1108 We use Jira to track the state of pull requests and the versions they got |
What about |
@stof implicit indexes are also stored in the regular index array. So this is no problem. |
Allow overriding implicit indexes
👍 I can confirm this works for /**
* @ORM\Entity(repositoryClass="Application\Sonata\UserBundle\Entity\UserRepository")
* @ORM\Table(name="users",
* indexes={
* @ORM\Index(name="compartment_idx", columns={"compartment_id"}),
* },
* uniqueConstraints={
* @ORM\UniqueConstraint(name="username_canonical_unique", columns={"username_canonical"})
* }
* )
*/ but running
|
The unique index |
This is a follow-up patch for the change introduced in #764.
It makes the
Table
class act more intelligent when it comes to preferring explicit over implicit indexes.Currently it is necessary to construct a
Table
instance in a specific order to not have unnecessary duplicate indexes because of foreign keys. If you first add a foreign key and afterwards and explicit index that is fulfilling the implicit one, both indexes are stored. Instead it is more intelligent to replace the implicit by the explicit one if and only if the explicit one fulfills the implicit one.This should also fix possible issues with how ORM's schema tool constructs a schema. See here where for a OneToOne relation on a primary key an additional regular index for the foreign key is created.