drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Bulk update using values

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

Description

### Describe the enhancement you want to request

Being able to bulk update multiple rows in one statement using values, similar to how you can bulk insert in one statement using values, would be great. The main motivations are performance and avoiding problems with swapping values of a unique column, which breaks if done sequentially regardless of order.

See this stackoverflow question for the desired syntax on the SQL side: https://stackoverflow.com/questions/18797608/update-multiple-rows-in-same-query-using-postgresql

Currently it seems the easiest approach is to just use `db.execute(sql...)` despite losing all the usual benefits of a type safe sql builder.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by reading the existing bulk-insert and values-building support, then compare it with the db.execute(sql...) path and the linked PostgreSQL syntax. Done means multiple rows can be updated in one statement through the type-safe SQL builder, including swaps of unique-column values.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql, typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.