Return affected rows from `deleteMany()` operation
Open
Nobody has claimed this yet.
kind/feature
topic: client api
topic: deleteMany()
topic: RETURNING
- Dominant language
- TypeScript
- Stars
- 47.6k
- Forks
- 2.5k
- Avg merge
- 21h 59m
- Merged PRs (30d)
- 95
Description
Problem
It is suggested that deleteMany can return the deleted column
Suggested solution
const user = await client.user.deleteMany({ where: { id: { in: params.id } } })
Generated query
DELETE FROM "user" WHERE "id"in(1,2) RETURNING *
Alternatives
For some tables, I need to delete some corresponding files by returning the deleted columns, and now I can only write SQL by queryRaw
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the deleteMany operation in the TypeScript client and its generated SQL path; compare the proposed DELETE ... RETURNING * behavior with the existing queryRaw workaround. Done means deleteMany exposes the deleted rows or columns for the supported database cases, with the behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- api, backend-api-design, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100