Drizzle Kit
CLI migration tool for Drizzle ORM that auto-generates SQL migrations intelligently.
3. Used by agents' projects
Dependency in 244 public GitHub projects set up for AI coding agents that we scanned (3.9%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
orm.drizzle.team/llms.txtFrom the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Drizzle Kit does
Drizzle Kit is the command-line half of Drizzle: it reads the TypeScript schema you already wrote for the ORM, then either writes SQL migration files from it or applies the change straight to the database.
Drizzle Kit popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Drizzle Kit is used
- Drizzle Kit is a dependency in 244 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.0% of the 4,867 JavaScript/TypeScript ones), #4 of 120 in databases, orms and clients.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 792; those are left out of every share on this page.
- Projects that use it most often also use Drizzle ORM (98.0%), Zod (78.3%), Class Variance Authority (55.3%).
- It is more common in projects set up for OpenCode (7.3%) than for OpenClaw (3.0%).
By coding agent
Often used with
Drizzle Kit in practice
Strengths
The README describes two paths. Kit can write SQL migration files for you to commit and apply later, or it can apply the schema change to the database directly.
Storyie uses <code>drizzle-kit generate</code> for every structural change: new tables and columns, type changes, indexes and foreign keys. Kit compares the schema with its previous state and writes the SQL, so no one hand-writes DDL.
<code>generate --custom</code> skips the diff and creates an empty SQL file for you to fill in by hand. Storyie used these files for seed rows, back-fills, row copies and Stripe price updates.
According to the release note, Kit v0.27.0 added Row-Level Security support for PostgreSQL. It covers managing roles and policies and enabling RLS for tables and views.
Watch out for
Storyie notes that Kit has no way to migrate down. Their fallbacks: <code>drizzle-kit drop</code> for files that have been generated but not applied, a forward fix for applied ones, and Supabase point-in-time recovery for data loss.
Storyie calls <code>entities.roles.provider: "supabase"</code> in the config "not optional". Without it, they write, the generated SQL can clash with Supabase's roles or produce malformed policy statements.
Storyie reviews every auto-generated file before committing. Their reason: the diff can produce something unexpected, such as recreating a column where you expected an in-place change.
Schema example from the Drizzle overview (shown beside a migration.sql tab)
// manage your schema
export const countries = pgTable ( 'countries' , {
id : serial () .primaryKey () ,
name : varchar ({ length : 256 }) ,
});
export const cities = pgTable ( 'cities' , {
id : serial () .primaryKey () ,
name : varchar ({ length : 256 }) ,
countryId : integer ( 'country_id' ) .references (() => countries .id) ,
});More about Drizzle Kit
Funding
- GitHub Sponsors: https://github.com/drizzle-team
- 68 GitHub sponsors
Packages around it
- drizzle-orm: TypeScript ORM
- zod: Schema validation
- tailwind-merge: Tailwind class merging
- class-variance-authority: Component variants
- clsx: className builder
- tsx: TypeScript runner
More in Databases, ORMs and clients
Alternatives
Drizzle Kit This page
Get started
Install it.
npm install drizzle-kitRules for your agent
## Drizzle Kit
- Make structural changes in the TypeScript schema, then run `drizzle-kit generate` to write the SQL migration. Do not hand-write DDL for schema changes.
- Put data changes (seeds, back-fills, row copies) in files from `drizzle-kit generate --custom`. Never mix DDL and DML in one migration.
- Read every generated SQL file before committing. Watch for a column being recreated where you expected an in-place alteration.
- Write custom migration SQL so it is safe to re-run, for example with `ON CONFLICT DO NOTHING`.
- On Supabase, set `entities.roles.provider: "supabase"` in `drizzle.config.ts`, and declare RLS in the schema with `.enableRLS()` so policies generate with the table.
- There is no migrate-down command. Use `drizzle-kit drop` only for generated files that have not been applied. Fix applied migrations with a new forward migration.
- For Expo SQLite, OP SQLite or React Native, follow the Get Started guide for migrations.