Skip to content

Backport #6008 - Avoid duplicate MySQL foreign key names - #7431

Merged
janmeier merged 1 commit into
sequelize:v3from
nathanpjones:fix-mysql-fk-constraint-names
Mar 27, 2017
Merged

janmeier merged 1 commit into
sequelize:v3from
nathanpjones:fix-mysql-fk-constraint-names

Conversation

@nathanpjones

@nathanpjones nathanpjones commented Mar 25, 2017 •

Copy link
Copy Markdown

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does your issue contain a link to existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Have you added an entry under Future in the changelog?

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

This is simply a backport of #6008 which is already accepted on master and part of the v4 branch.

This fixes a problem with duplicate foreign key constrain names in MySQL (issue #5826). Instead of using the collision-prone template {attribute}_foreign_idx, this change will cause {referring_table}_{attribute}_foreign_idx to be used instead.

Fix for MySQL fk constraint names to incorporate referring table name
and avoid possible name collisions.

Cherry-picked from 85477dd
See also issue sequelize#5826
@mention-bot

Copy link
Copy Markdown

@nathanpjones, thanks for your PR! By analyzing the history of the files in this pull request, we identified @treythomas123, @sdepold and @optilude to be potential reviewers.

@nathanpjones nathanpjones changed the title Backport #6008 Backport #6008 - Avoid duplicate MySQL foreign key names Mar 25, 2017
@codecov-io

codecov-io commented Mar 25, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #7431 into v3 will increase coverage by 5.04%.
The diff coverage is n/a.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a0997b...99d97c9. Read the comment docs.

@janmeier
janmeier merged commit 85412bf into sequelize:v3 Mar 27, 2017
@janmeier

Copy link
Copy Markdown
Member

Welcome @nathanpjones , and thanks for your contribution :)

holm pushed a commit to holm/sequelize that referenced this pull request Nov 13, 2017
Fix for MySQL fk constraint names to incorporate referring table name
and avoid possible name collisions.

Cherry-picked from 85477dd
See also issue sequelize#5826
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.

4 participants