drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: [RQBV2] Allow for relational objects to be used in `.query()`'s `orderBy`
Open
enhancement
rqb
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
As stated in title, wish I could use a relational parent's attributes in sorting the output of a query, like in the statement below
```
await db.query.carModelAndYear.findMany({
where: {
modelId,
year,
},
with: {
model: true,
},
orderBy: {
model: { <-------- WISH I COULD DO THIS
modelName: "asc",
},
},
});
```
Allows for easier sorting out of the DB - I know I can sort after the fact, but could support this via SQL
Contributor guide
Assessment
This issue has not been assessed yet.