drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Join type in query system when foreign key is nullable

Open
#2,787 0 comments 0 reactions 0 assignees View on GitHub
improvement rqb
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

Is there a way to detect if the foreign key should be nullable or not based on the query?
Current behaviour:
```
const result = await drizzleClient.query.table.findMany({
where: isNotNull(table.foreignKey),
with: {
joinTable: true,
}
});
result.joinTable // type is still nullable
```
Is there a way to declare the join type to allow for type safe joins, or detect it through isNotNull?
For example if i could join the the table with inner join and make the type required?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.