drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Add "DELETE USING" api for pg driver

Open
#793 3 comments 17 reactions 0 assignees View on GitHub
db/postgres enhancement priority qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

Hello.
I'm trying to implement delete operation which require some joins by fk in pg database. According to the pg documentation it is possible with the help of "USING" clause. Currently it is not available in drizzle-orm, so I use following workaround:
```typescript
db.execute(sql`DELETE FROM ${customervehicle}
USING ${vehicle}
WHERE ${customervehicle.vehicleid} = ${vehicle.vehicleid}
AND ${vehicle.sessionid} = ${sessionId}
AND ${customervehicle.customerid} = ${customerId}
RETURNING *`);
```
It would be great to have an appropriate drizzle-orm api for this.

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.