Drizzle ORM CLI for generating SQL migrations, introspecting databases, applying migrations, and pushing schema changes.
$npm install -D drizzle-kit
AI Analysis
drizzle-kit is the schema and migration CLI for Drizzle ORM. It compares code-defined schemas with prior snapshots or live databases to generate SQL, apply migrations, introspect existing databases, and push schema changes.
What It Enables
- Generate SQL migration files from Drizzle schema changes, including empty custom migrations when a change cannot be expressed from the schema diff alone.
- Apply migrations, validate or upgrade local migration snapshot metadata, and remove the latest recorded migration from a local migrations folder.
- Introspect existing Postgres, MySQL, SQLite, Turso, SingleStore, or Gel databases into Drizzle files, or push schema diffs directly to a target database.
Agent Fit
- Core commands are plain subcommands with explicit flags, config-file support, and exit-on-error behavior, so they fit repo-local inspect and change loops well.
- Several high-impact paths still require human decisions: rename conflict resolution prompts during generation, approval prompts for destructive
pushstatements, and an interactive selector fordrop. - Automation has to work with generated files and human-oriented stdout because the CLI does not expose native JSON output;
studioalso shifts the workflow into a local web UI rather than a pure shell loop.
Caveats
- The listed GitHub repo is an archived mirror; the maintained source now lives inside the
drizzle-ormmonorepo. - Most useful commands depend on a project-specific Drizzle config and working database credentials, so the CLI is strongest when an agent already has repo context and environment setup.