-
-
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
[DBAL-1062] Fix renaming indexes used by foreign key constraints #756
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1092 We use Jira to track the state of pull requests and the versions they got |
@@ -2080,6 +2078,28 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) | |||
); | |||
} | |||
|
|||
if (! $this->supportsForeignKeyConstraints()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this new block be moved to a new private method? getForeignKeyConstraintChangesSql()
maybe?
Looking really good to me! Nitpicking to be fixed, but then mergeable |
e647fbd
to
dbec00f
Compare
@Ocramius reworked the PR as I recognized this is only an issue for MySQL < 5.7. All other platforms' foreign key constraints do not require an index to be present. This is something related to InnoDB only. Less code now, less abstraction necessary. |
[DBAL-1062] Fix renaming indexes used by foreign key constraints
Backported into 2.5.x at 2e4ed5f |
Sadly this didn't worked for me, i'm upgrading from dbal 2.3.x at mysql 5.6 and all my indexes are still being recreated. Is there any way to make it work? =( |
@dbpolito from 2.3? Could you try upgrading to 2.4 first, and see if the bug is there? |
@Ocramius Upgrading to 2.4 went fine, and already fixed the issue i was having first, which make it work with php 5.6, for some reason i didn't receive the notifications from doctrine/orm#1154 (comment) , would made my life easier. But after upgrading to 2.4, if do upgrade to 2.5 this issue still happens... |
Platforms that do not support a SQL syntax for natively renaming indexes need to drop and recreate indexes to perform a rename.
Platforms like MySQL < 5.7 deny dropping indexes used by foreign key constraints. In this case foreign key constraints have to be dropped before dropping indexes and have to be recreated after the particular index(es) have been recreated.
This is a major issue right now for people trying to upgrade to DBAL 2.5.