WITH + UPDATE

Hey, I’m not sure how’s best to convert this query to something usable in drizzle. I’m happy to just raw dog the sql operator but I’m not sure how to still get the great typing with it. I can’t seem to combine “With” with anything but select. Please help! WITH locked_jobs AS ( SELECT * FROM jobs WHERE state = 'available'::job_state) UPDATE job SET state = 'running'::job_state, FROM locked_jobs WHERE jobs.id = locked_jobs.id RETURNING job.*;
2 Replies
Angelelz
Angelelz13mo ago
This is in progres, there is actually an Open PR for it.
Angelelz
Angelelz13mo ago
GitHub
Improve with clause by L-Mario564 · Pull Request #1578 · drizzle-...
Addresses #344 and #1541. This PR makes it so you can use a with clause alongside insert, update and delete. Things worth mentioning: MySQL doesn't support with ... insert. selectDistinct and ...
Want results from more Discord servers?
Add your server