drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Safe Update, a config to disable any update clause from running without a where clause

Open
#4,324 12 comments 6 reactions 0 assignees View on GitHub
enhancement qb/crud
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

Hello,

I have fallen victim to my own speedy development efforts and forgotten to provide a _where_ clause in an _update_ statement. Other ORM's I've used won't allow the _update_ to run without a _where_ clause being specified / acknowledgement that I actually mean to update every entry in a table.

To save me from myself, and probably others, can we have a configuration where updating a table will cause a build/run time failure if a valid _where_ clause is not specified.

Benefits: I don't blow away all of my clients secret keys in a _where_ clause I didn't check properly for the sake of a flag I can enable myself, and would absolutely prefer to have on, as I can't really think of a reason why I would ever pass a global update at the application level that I wouldn't rather be performing in a migration.

Cons: time taken to implement such a feature, I will be sad and have to try even harder than I already do not to be my own worst enemy.

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.