drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: DB level config: "safe where"

Open
#3,393 0 comments 3 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

### Describe what you want

I understand there's the [eslint plugin](https://orm.drizzle.team/docs/eslint-plugin#enforce-delete-with-where) and some [issues about it](https://github.com/drizzle-team/drizzle-orm/issues?q=is%3Aissue+%22+without+where%22+is%3Aclosed).

But what I would propose is, at the [config file](https://orm.drizzle.team/docs/drizzle-config-file), to add a boolean check `safeWhere?: boolean` (defaults to false (maybe))

If checked, it will throw any update/delete without a where clause.
Then additionally, a new [operator](https://orm.drizzle.team/docs/operators) `all()` (that could also work with the eslint approach).

When you _want_ to delete/update "without where", then you would need to `.where(all())` to make it explicit.

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.