Skip to content
Back to skills

Drizzle Knowledge Patch

ASecurity

Drizzle ORM

  • 25 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmentgosqlnodeexpressapidatabase

Works with

  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill drizzle-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Drizzle Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Drizzle Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-drizzle-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-drizzle-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: drizzle-knowledge-patch
description: Drizzle ORM
version: "1.0.0-beta.19"
license: MIT
metadata:
  author: Nevaberry
---


# Drizzle ORM Knowledge Patch

Use this skill when updating Drizzle queries, schema validation, database
drivers, or Drizzle Kit workflows. Load the relevant reference for the full
guidance on the task at hand.

| Reference | Topics |
| --- | --- |
| [Queries and Runtime](references/queries-and-runtime.md) | Escaping, casing, API removals, codecs, query execution, Effect, database adapters |
| [Migrations and Drizzle Kit](references/migrations-and-kit.md) | Module loading, output modes, hints, migration branches, introspection, schema discovery, MCP, skills |
| [Schema Validation](references/schema-validation.md) | Built-in Zod integration, views and enums, field overrides, coercion, generated constraints, JSON |

## Breaking changes and deprecations

### Upgrade for identifier and alias escaping

Drizzle ORM 0.45.2 corrects escaping for names passed to `sql.identifier()`
and SQL expression aliases set with `.as()`. Upgrade to 0.45.2 to get the
fix for a potential SQL injection vulnerability in these APIs.

### Move relational queries to the v2 API

Drizzle drops `db._query` for PostgreSQL in `1.0.0-rc.1`, MySQL in
`1.0.0-rc.3`, and SQLite in `1.0.0-rc.4`. Move callers to Relational Queries
v2 via `db.query`. Remove SQLite's v1 `TSchema` and `TFullSchema` generic
arguments.

### Put casing on entities

In `1.0.0-rc.1`, replace instance-level `casing` with `snakeCase` or
`camelCase` constructors for tables, views, materialized views, and schemas.
A schema created this way also supplies casing-aware constructors for its
entities.

```ts
import { snakeCase, text } from 'drizzle-orm/pg-core';

export const users = snakeCase.table('users', { fullName: text() });
// The database column is full_name.
```

### Update PostgreSQL imports and custom codecs

In `1.0.0-rc.1`, import `makePgArray` and `parsePgArray` from
`drizzle-orm/pg-core/array`. The previous entry points were
`drizzle-orm/pg-core/utils` and `drizzle-orm/pg-core/utils/array`.

In `1.0.0-rc.2`, select a PostgreSQL custom column codec explicitly with
`codec`, which accepts callbacks. Update point codec names from `geometry`
and `geometry:tuple` to `geometry(point)` and `geometry(point):tuple`.

### Update prepared, raw, and SQLite APIs

In `1.0.0-rc.2`, prepared query builders drop `typings`. In `1.0.0-rc.4`,
`PreparedQuery` drops `mapResult`, and PostgreSQL and SQLite raw queries
drop `mapResult` and `mapBatchResult`.

In `1.0.0-rc.4`, `SQLiteSyncDialect` and `SQLiteAsyncDialect` are removed.
Import the generic migrators `migrateSync` and `migrateAsync` from
`drizzle-orm/sqlite-core/async/session`.

### Update Effect dependencies and response handling

`effect-schema` and `effect-postgres` switch from Effect v3 to the v4 beta
in `1.0.0-rc.1`. `1.0.0-rc.4` requires `effect@4.0.0-beta.83`.
In `1.0.0-rc.4`, import `EffectDrizzlePgConfig` from
`drizzle-orm/pg-core/effect/utils`, and expect the raw driver response from
`db.execute()` with `@effect/sql-pg`.

### Use the built-in Zod integration

Starting with `drizzle-orm@1.0.0-beta.15`, install `zod` alongside the ORM
and import schema generators from `drizzle-orm/zod`. The deprecated
`drizzle-zod` package still works; future updates go to the built-in
integration.

## Query quick reference

### Preserve SQL expression nullability

In `1.0.0-rc.4`, `mapWith()` on `sql<T>` infers the mapper input from `T`
and carries through `null` in the expression's result type. Use `.nullable()`
to add `null` to an expression's result type explicitly.

```ts
import { sql } from 'drizzle-orm';

const value = sql<number | null>`nullif(1, 1)`.mapWith((n) => String(n));
// n has type number and the mapped expression has type string | null.
```

### Enable JIT mappers and insert from select

Starting in `1.0.0-rc.1`, pass `jit: true` in the `drizzle()` config to
generate row mappers. A prepared query reuses its mapper on subsequent
executions.

In `1.0.0-rc.4`, selections passed to `db.insert(table).select(...)` can
use a different column order from the target table and omit nullable
columns or columns with defaults.

### Account for set-operation codecs

In `1.0.0-rc.4`, a PostgreSQL or MySQL set operation uses the codec for the
database's resulting type when both input columns have codecs. Otherwise
the result inherits the left column's codec behavior, including the absence
of a codec. Database coercion can still lose information.

### Add query tags on the builder

Starting in `1.0.0-beta.19`, PostgreSQL and MySQL query builders can append
SQL comments with `.comment({ priority: 'high' })` or
`.comment("priority='high'")` before execution. Apply comments on the
builder: prepared statements lack `.comment()`, and the builder's string
overload was restored in `1.0.0-rc.4`.

### Account for SQLite and MySQL execution behavior

In `1.0.0-rc.4`, synchronous SQLite drivers can execute counts with
`db.$count(users).sync()`. SQLite query failures are wrapped in
`DrizzleQueryError`, with `db.batch()` as an exception.

In `1.0.0-rc.3`, iterator queries fall back to regular queries when a
MySQL driver lacks streaming support.

## Drizzle Kit quick reference

### Load project modules and handle non-TTY execution

On Node.js, Drizzle Kit 0.31.10 replaces `esbuild-register` with the `tsx`
loader and can load both ESM and CommonJS project modules. It can also run
natively under Bun and Deno, using each runtime's import system for project
modules. It reports errors when terminal interaction is required in a
non-TTY environment, such as a CI job without a terminal.

### Use structured output and migration hints

In `1.0.0-rc.4`, `generate`, `push`, `pull`, `up`, `export`, and `check`
accept `--output text` or `--output json`.
`npx drizzle-kit generate --output json` emits a typed envelope with status,
errors, and payloads. `drizzle-kit/cli` exposes matching typed `generate()`,
`push()`, `pull()`, `up()`, `exportSql()`, and `check()` functions.

In `1.0.0-rc.4`, JSON output and text output with non-TTY stdin both
suppress interactive prompts. Supply a structured hints array through
`--hints` or `--hints-file` to resolve rename and `confirm_data_loss`
decisions. Otherwise, these appear as `missing_hints` in JSON or as a
missing-decisions report in text.

### Work with migration branches

In `1.0.0-rc.2`, `drizzle-kit generate` checks open SQLite migration
branches for conflicts and records all open leaf IDs in the next snapshot's
`prevIds`. Use `npx drizzle-kit generate --ignore-conflicts` or
`npx drizzle-kit check --ignore-conflicts` to bypass the check for that
invocation.

In `1.0.0-beta.22`, PostgreSQL and MySQL migration checks accept unrelated
index changes on different tables, and `--ignore-conflicts` preserves all
open leaf parents for the next migration. Starting in `1.0.0-beta.21`,
adding a PostgreSQL enum value is treated as non-commutative, and Kit merges
enum values added on separate migration leaves.

### Discover schema files and introspect PostgreSQL

Starting in `1.0.0-beta.19`, Kit processes only `.js`, `.mjs`, `.cjs`,
`.jsx`, `.ts`, `.mts`, `.cts`, and `.tsx` when discovering schema files.
In `1.0.0-beta.18`, schema loading gains wildcard and non-wildcard
`tsconfig` path aliases. In `1.0.0-rc.4`, PostgreSQL `drizzle-kit pull`
can run under non-admin roles.

## Schema validation quick reference

### Refine or replace fields

In a schema generator's second argument, a field callback runs before
Drizzle applies the column's nullability and optionality. Passing a Zod
schema directly takes over the whole field: declare any required
`.nullable()` or `.optional()` on that schema.

Generated JSON validators check the top-level value as a JSON primitive,
record, or array and accept arbitrary nested values. Supply a field
refinement or replacement schema to enforce the nested shape.

### Configure the Zod instance and coercion

`createSchemaFactory({ zodInstance: z })` binds returned generators to an
extended Zod instance, allowing refinements to call methods such as
`.openapi()` from `@hono/zod-openapi`. Use `coerce: true` for all supported
coercions or a per-type map such as `{ date: true }` to generate
`z.coerce.date()` for date-valued columns.

### Check generated constraints

PostgreSQL `bit({ dimensions })` generates
`z.string().regex(/^[01]+$/).max(dimensions)`, so shorter nonempty bit
strings can pass. PostgreSQL and MySQL `char({ length })` generate
exact-length checks; `varchar({ length })` generates a maximum-length check.
The schema validation reference contains the numeric bounds and guidance
for view and enum schemas.

## Database adapter quick reference

For the `1.0.0-rc.1` adapter at `drizzle-orm/netlify-db`, install
`@netlify/database`. Its `drizzle()` factory accepts no arguments, a
database URL, or `{ client: netlifyDbClient }` to reuse an existing client.

Drizzle ORM 0.45.3 adds the Netlify DB adapter with `@netlify/db`.
Calling `drizzle()` without arguments reads `NETLIFY_DB_URL` and
`NETLIFY_DB_DRIVER`.

The queries and runtime reference also covers additional Effect SQL
drivers, serverless, sync, and WASM database drivers, PostgreSQL proxy
dialect config, and SQL Server optional peer dependencies.

Files in this skill

  • SKILL.md6.7 KB
  • coverage.json540 B
  • references/migrations-and-kit.md1.8 KB
  • references/queries-and-runtime.md1.6 KB
  • references/schema-validation.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.