Skip to content

fix: allow falsey discriminator values#6973

Merged
pleerock merged 1 commit intotypeorm:masterfrom
imnotjames:feat/discriminator-value
Oct 26, 2020
Merged

fix: allow falsey discriminator values#6973
pleerock merged 1 commit intotypeorm:masterfrom
imnotjames:feat/discriminator-value

Conversation

@imnotjames
Copy link
Contributor

@imnotjames imnotjames commented Oct 26, 2020

Description of change

This allows discriminator values in Single Table Inheritance - such as 0, "", or null

Before, if you attempted to use a discriminator for 0 you'd receive errors about an invalid
discriminator value, or the metadata just wouldn't register correctly.

Now, you can use a discriminator value that's "falsey" but not undefined.

fixes #3891

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 #0000
  • 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

allow discriminator values in Single Table Inheritance
like 0, "", or `null`

fixes typeorm#3891
@imnotjames imnotjames force-pushed the feat/discriminator-value branch from 9521fc2 to 544a3a5 Compare October 26, 2020 06:20
@imnotjames imnotjames added the hacktoberfest-accepted label hacktoberfest label Oct 26, 2020
@pleerock pleerock merged commit f3ba242 into typeorm:master Oct 26, 2020
dolsup pushed a commit to dolsup/typeorm that referenced this pull request Nov 3, 2020
allow discriminator values in Single Table Inheritance
like 0, "", or `null`

fixes typeorm#3891
zaro pushed a commit to zaro/typeorm that referenced this pull request Jan 12, 2021
allow discriminator values in Single Table Inheritance
like 0, "", or `null`

fixes typeorm#3891
@imnotjames imnotjames deleted the feat/discriminator-value branch June 21, 2021 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted label hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zero as a discriminator value

2 participants