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

fix: Single table inheritance returns the same discriminator value error for unrelated tables where their parents extend from the same entity #8525

Merged

Conversation

marypaz-sama
Copy link
Contributor

Description of change

Fixes: #8522

When there are two unrelated child entities following the single table inheritance pattern with same discriminator value, if both entities inherit from a class that just adds some common columns it, it throws an error. So the change is to be sure that we are only checking within entities that have the same db table.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes [#8522](https://github.com/typeorm/typeorm/issues/8522)
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change N/A
  • The new commits follow conventions explained in CONTRIBUTING.md

…ror for unrelated tables where their parents extend from the

 same entity

Add a new condition in entity metada validator to be sure that we are testing the same table

Solve: typeorm#8522
Add missing entity to the last commit

Solve: typeorm#8522
Add a new test to prove that related tables failed when they have the same discriminator

Solve: typeorm#8522
@pleerock pleerock merged commit 6523fcc into typeorm:master Jan 15, 2022
@pleerock
Copy link
Member

Thank you for contribution! 🎉

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