# Drizzle ORM solution docs

- [Adding a NOT NULL column to a table that already has rows](https://agenticboilerplate.com/cookbook/drizzle/adding-a-column-with-a-backfill): The one-line migration fails on any populated database. Split it into add-nullable, backfill in batches, and enforce: three migrations across two deploys.
- [drizzle-kit generate or drizzle-kit push, and when each is safe](https://agenticboilerplate.com/cookbook/drizzle/generate-vs-push): push diffs your schema straight onto the database with no file to review; generate writes SQL you commit. Use push only on a database you can throw away.
- [db.query relations or an explicit join: choosing in Drizzle without an N+1](https://agenticboilerplate.com/cookbook/drizzle/relations-vs-joins): The relational API returns nested objects and one round trip; the core builder returns flat rows and total control. Which to reach for, and the loop that quietly becomes N+1.
- [Transactions in Drizzle on serverless: what works over HTTP and what needs a socket](https://agenticboilerplate.com/cookbook/drizzle/transactions-in-serverless): An interactive db.transaction() needs a real connection held open. On an HTTP driver it silently is not one. Here is what each driver supports and how to write atomic writes without holding a connection.
- [Typing partial selects and joins in Drizzle without writing the types by hand](https://agenticboilerplate.com/cookbook/drizzle/typing-partial-selects): $inferSelect describes the whole row, not the three columns you selected. Use the query builder's inferred types, Awaited<ReturnType<...>>, and helper types instead of hand-maintained interfaces.

---

Agentic Boilerplate: A Next.js repo your agent already knows. Free during launch, then $99 once.

- Site map for agents: https://agenticboilerplate.com/llms.txt
- Public API: https://agenticboilerplate.com/openapi.json
- Contact: agenticstudio@gmail.com
