drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Relational API - Nested Insert and Update
- 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
It would be nice for the Relational API to support Nested Inserts and Updates:
```ts
await db.update({
authors: {
name: 'Jane Austen',
books: {
insert: [
{ title: 'Pride and Prejudice' },
{ title: 'Sense and Sensibility' },
],
},
},
});
For update, we would need a key, so:
await db.insert({
authors: {
name: 'Jane Austen',
books: {
update: [
{ id: '0x123', title: 'Pride and Prejudice' },
{ id: '0x234', title: 'Sense and Sensibility' }
],
},
},
});
```
It would probably resolve to a CTE under-the-hood.
https://github.com/drizzle-team/drizzle-orm/issues/2078#issuecomment-2561207768
J
Contributor guide
Assessment
This issue has not been assessed yet.