DDC-2515: Schema tool ignores index names in mapping file and uses generated name #3157

Closed
opened 2026-01-22 14:14:01 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 18, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user hussdl:

I have defined an index on a foreign key colum in my .dcm.xml mapping file:

<indexes>
      <index name="ix*date_created__client_id" columns="date_created,client*id"/>
      <index name="ix*user_id" columns="user*id"/>
</indexes>

However, the resulting CREATE TABLE statement includes:

    INDEX IDX*4848DD9FA76ED395 (user*id), 
    INDEX IDX*4848DD9F4239E22F (accessgroup*id), 
    INDEX IDX*4848DD9FD2112630 (usergroup*id), 
    INDEX ix*date_created__client_id (date_created, client*id), 

So Doctrine seems to be auto-generating indexes for all foreign key columns. I'm assuming this is a feature, even though I'd argue that there are real-life examples where the mere presence of a foreign key constraint does not justify indexing that column. :)

Anyway, the expected behavior is that Doctrine does not replace existing indexes with generated ones. I will attach a failing test case unless this bug is immediately dismissed as wontfix.

Originally created by @doctrinebot on GitHub (Jun 18, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user hussdl: I have defined an index on a foreign key colum in my .dcm.xml mapping file: ``` xml <indexes> <index name="ix*date_created__client_id" columns="date_created,client*id"/> <index name="ix*user_id" columns="user*id"/> </indexes> ``` However, the resulting CREATE TABLE statement includes: ``` sql INDEX IDX*4848DD9FA76ED395 (user*id), INDEX IDX*4848DD9F4239E22F (accessgroup*id), INDEX IDX*4848DD9FD2112630 (usergroup*id), INDEX ix*date_created__client_id (date_created, client*id), ``` So Doctrine seems to be auto-generating indexes for all foreign key columns. I'm assuming this is a feature, even though I'd argue that there are real-life examples where the mere presence of a foreign key constraint does not justify indexing that column. :) Anyway, the expected behavior is that Doctrine does not replace existing indexes with generated ones. I will attach a failing test case unless this bug is immediately dismissed as wontfix.
admin added the Bug label 2026-01-22 14:14:01 +01:00
admin closed this issue 2026-01-22 14:14:01 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 21, 2013):

Comment created by hussdl:

Test case for SchemaToolTest

@doctrinebot commented on GitHub (Jun 21, 2013): Comment created by hussdl: Test case for SchemaToolTest
Author
Owner

@beberlei commented on GitHub (Dec 5, 2020):

Duplicate of https://github.com/doctrine/orm/issues/3294

@beberlei commented on GitHub (Dec 5, 2020): Duplicate of https://github.com/doctrine/orm/issues/3294
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3157