mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
One-to-one relation resulting in two identically named indexes #6372
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @melvinkoopmans on GitHub (Dec 20, 2019).
Support Question
I have two entities
ContentItemVoteandCommentwhich both have a One-to-One relationship with theContentIndexentity. The content index has a fielditemType(commentorcontent-item) anditemID(the ID of the comment or content item).It looks like this:
Doctrine will create a unique index with these columns. The name of this index is based on the field name (
contentIndex). This results in two indexes with the same name, which is not possible.In
Doctrine/ORM/Mapping/ClassMetadataInfo.php', line1594:and then later at line
1631:Now both indexes are named
contentIndex_uniqand I get a SQL error:SQLSTATE[HY000]: General error: 1 index contentIndex_uniq already exists.Is this a bug in Doctrine? Am I doing something wrong? It would be helpful if I could chose the name of this index myself.
Thanks in advance!