Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .orderBy() and .limit() in update and delete statements (MySQL | SQLite) #2981

Merged
merged 9 commits into from
Oct 14, 2024

Conversation

L-Mario564
Copy link
Collaborator

Addresses #535 and #574.

This PR adds support for .orderBy() and .limit() in update and insert statements in MySQL and SQLite.

await db.insert(users).values([
  { name: 'Barry', verified: false },
  { name: 'Alan', verified: false },
  { name: 'Carl', verified: false },
]);

/*
 * Only update the first two rows, ordering by name ascending. Ending up with the following rows:
 * { name: 'Alan', verified: true },
 * { name: 'Barry', verified: true },
 * { name: 'Carl', verified: false }
*/
await db.update(users).set({ verified: true }).limit(2).orderBy(asc(users.name));

@L-Mario564 L-Mario564 changed the base branch from main to beta September 17, 2024 17:46
@L-Mario564 L-Mario564 changed the title Support .orderBy() and .limit() in update and insert statements (MySQL | SQLIte) Support .orderBy() and .limit() in update and delete statements (MySQL | SQLite) Oct 10, 2024
@AndriiSherman AndriiSherman merged commit 6764bd8 into drizzle-team:beta Oct 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants