📝 docs: clarify drizzle raw sql guidance#15467
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f91533e776
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Expression-level `sql<T>` is fine inside a Drizzle builder for PostgreSQL features | ||
| that do not have a dedicated helper, such as JSON path extraction, casts, aggregate | ||
| expressions, `CASE`, `NOW()`, advisory locks, or `FOR UPDATE`. |
There was a problem hiding this comment.
Use the select lock builder for FOR UPDATE
When a query needs row locking, FOR UPDATE is not an expression-level fragment like CASE or a cast; Drizzle's Postgres select builder exposes a lock clause via .for('update', ...). Leaving it in this list encourages putting sql\FOR UPDATE`` into a select projection/condition, which can generate invalid SQL or skip the intended row lock in latency-sensitive transactional paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 3e02e74: removed FOR UPDATE from the expression-level sql<T> list and added a .for('update') row-lock example.
💻 Change Type
🔗 Related Issue
N/A
🔀 Description of Change
Clarifies the Drizzle skill guidance for raw SQL refactors:
sql<T>inside builders for PostgreSQL-specific expressions.execute.🧪 How to Test
Validated with:
📸 Screenshots / Videos
N/A
📝 Additional Information
Docs-only skill update.