Allow null on a field with a relationship does not work
See original GitHub issueThe resulting table ends up with a not null constraint, even when creating the field manually instead of using the Relationship helper functions:
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
relationship: {
kind: "single",
model: Location,
}
}
I also tried setting parentId: null
in the static defaults object but the result is the same, the table ends up being created with a not null constraint.
I’m reading the code to see if I can find why this is happening.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Solved: Handling null in one-to-many relationship
Hello. I have 2 simple tables with what I would expect to be a 1 to many relationship. Problem 1. PowerBI however imposes...
Read more >sql - What does/should NULL mean along with FK relationships
It's perfectly acceptable, and it means that, if that column has any value, its value must exist in another table.
Read more >How To Enter Empty (Null) Into Table Field With Relationship ...
Basically I want to give the user the chance to enter nothing, i.e. NULL, i.e. not pick anything from the dropdown list.
Read more >Why shouldn't we allow NULLs? - DBA Stack Exchange
NULL values represent unknown data NOT unused data. If you have an employee table that has a termination date field. A null value...
Read more >Using nullability in GraphQL
A field can either be nullable or non-null, and this tells you whether or not you could receive a null value when you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright! I did the changes. You can use my fork to import DenoDB while we wait the merge:
If you have a problem, let me know. If you don’t, please close the issue.
Good coding! 🙂
No problem! Actually yes, I was having problems with the automatically created timestamp fields but I just decided to stop using that option and it worked so I stopped trying to mess with it.
I just checked your repo and I remember finding your pull request when searching about that problem I was having, I was hoping your pull request got merged.