Skip to content
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

[WIP] Foreign association index names #956

Closed

Conversation

jsuggs
Copy link

@jsuggs jsuggs commented Feb 19, 2014

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DDC-2990

We use Jira to track the state of pull requests and the versions they got
included in.

$foreignTableName,
$localColumns,
$foreignColumns,
$fkOptions
$fkOptions,
$fkName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is worng because it is the name of the foreign key constraint and not the name of the index to be created under the hood. What you need to do is call $theJoinTable->addIndex() before adding the foreign key and do not pass the index names as foreign key name when adding the foreign key.

@deeky666
Copy link
Member

This is a good start but missing a lot of things. We need to implement that addition in all mapping drivers and for all association types. Also we need tests for this. And as discussed before @beberlei does not like this solution. We should decide on a solution first before we put unnecesarry work into this (I have an open branch on this, too). Nevertheless thank you for contributing on this :)

@deeky666
Copy link
Member

Please prefix the PR name with [WIP] is it is work-in-progress. Thanks.

@jsuggs
Copy link
Author

jsuggs commented Feb 19, 2014

Sure, was just putting something out for conversation. Thanks for the feedback.

Were/how do conversations around new feature development typically happen? In the JIRA or do you collaborate on IRC, etc

@Ocramius
Copy link
Member

@jsuggs either push to the branch or on irc://freenode.net#doctrine-dev during CET times

@dbykadorov
Copy link

Hello, guys! Is there still work in progress? Very useful but missed ability...

@Ocramius
Copy link
Member

Ocramius commented Jan 9, 2015

@dbykadorov if you want to contribute, then provide tests for this PR

@Ocramius Ocramius self-assigned this Jan 13, 2015
@Ocramius
Copy link
Member

Closing as per @deeky666's review.

@Ocramius Ocramius closed this Jan 13, 2015
@Ocramius
Copy link
Member

This is actually fixed as per doctrine/dbal#769, which comes with release 2.5.1 of the DBAL.

@fmonts
Copy link

fmonts commented Dec 30, 2023

This is actually fixed as per doctrine/dbal#769, which comes with release 2.5.1 of the DBAL.

Still not fixed since it's not possible to set a custom name for a foreign key.

There are situations where you don't want to change the FK name, for example when dropping a FK and recreating it is not feasible because the table is huge, or when the db structure is shared between different applications.

For those coming here trying to find a way to do that, see this workaround: https://stackoverflow.com/a/77736787/3393663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants