drizzle-team / drizzle-team/drizzle-orm
[BUG]: Sqlite queries on columns with null values do not create a property in the returned object
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.29.4
### What version of `drizzle-kit` are you using?
0.20.14
### Describe the Bug
## The problem
I don't know if this is expected behavior or not, but when a column has a null value, the item property gets ignored and never gets created, in my case the time column.

### Table Schema

### Table values

### Drizzle schema

### The query getting executed to get the values out

Running this query in a dbBrowser for sqlite returns the following

The same query on a different set of images that do have a value in the time column, result in the time property being added to the object

### Expected behavior
### Expected Behavior
The object resulting should have the time property set to null, because otherwise this would lead to unexpected bugs like what happened to me where I had a check like this
`if (image.time !== null) {
newPlaylistImagesTimeSet.add(image.time);
}`
in this instance this evaluates to true, because undefined !== null so it lead to all sorts of headaches and an infinite loop blocking the main thread 🤣
type inference from the schema did not have a problem at all letting me do this because image.time should exist, technically even if it is null.
### What the query should return

### Final thoughts
Again, I don't know if there is something I'm missing, or if it's actually documented behavior, but I highly doubt it.
### Environment & setup
this occurs both in production and development.
Contributor guide
Assessment
This issue has not been assessed yet.