mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3365: Indexes and uniqueConstraints has been ignored #2649
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 @doctrinebot on GitHub (Oct 26, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user diegoholiveira:
I using the Doctrine Migrations and when I declared my entity with the indexes section, the index name has been ignored. It's like this:
indexes:
IDX_ADDRESS_CITY:
columns: city_id
but, the diff tools ignore it and give me this code:
$this->addSql("CREATE INDEX IDX_7299B5238BAC62AF ON tb_address (city_id)");
and it should be:
$this->addSql("CREATE INDEX IDX_ADDRESS_CITY ON tb_address (city_id)");
Notice: I open the same bug on the migrations repository in github and @kimhemsoe told me to open here, since this is generated by DBAL component.
@doctrinebot commented on GitHub (Dec 11, 2012):
Comment created by posulliv:
Did you specify an index name in the indexes property for your entity in your PHP file? In this case, you should have something like:
That should result in the correct SQL being generated. If I modify the above to:
I also get a migration that has SQL with an auto-generated index name.
@doctrinebot commented on GitHub (Feb 2, 2013):
Comment created by diegoholiveira:
Yes I did specify a name, as you can see:
I don't try do to it using annotations because I choose do use yaml to describe my entities. I will take a look on the source code to see if I can fix it and send a PR.
@doctrinebot commented on GitHub (Apr 2, 2013):
Comment created by diegoholiveira:
I already sent this patch to Guilherme Blanco, but I guess he doesn't have time to take a look on it.
I guess my solution it's not ideal, but it solve the problem and can be a base to make a better solution.
@doctrinebot commented on GitHub (Apr 20, 2013):
Comment created by @beberlei:
[~diegoholiveira] the fix doesn't seem too nice with the additional boolean flag.
I would rather like to fix the root cause instead of adding this solution.
@doctrinebot commented on GitHub (Apr 20, 2013):
Comment created by @beberlei:
The issue is tricky, because we cannot just move the index definitions above, they will need the columns, however that directly generates the index in the schema tool. Maybe if the gather join column methods would check if they can add an index already it would work.
@doctrinebot commented on GitHub (Oct 26, 2014):
Comment created by @deeky666:
Moving this to ORM as it is completely related to ORM's schema tool. The schema tool hast to declare the order and priority of indexes.
@Ocramius commented on GitHub (Aug 23, 2018):
Closing: this has been fixed before ORM 2.5 as far as I know.