- How you use it
- cli_tool
- What it can do
- installs software · network
- What's inside
The option
| Option | Acli_tool · v0.31.11Drizzle Kit CLI |
|---|---|
| How you use it | cli_tool |
| What it can do | installs software · network |
| What's inside |
What this thread does
The problem
You use Drizzle ORM and an agent suggests drizzle-kit push, then later generate and migrate. You want to know which to use and what goes wrong when they are mixed.
What the sources say
Drizzle's migrations docs (read October 2026) list these options:
- Push (
drizzle-kit push): codebase-first; Drizzle diffs your TypeScript schema against the database and applies it with no SQL files kept. The docs call it the best approach for rapid prototyping and say teams also use it in production. - Generate then migrate (
drizzle-kit generate,drizzle-kit migrate): codebase-first with versioned SQL files in a migrations folder; migrate applies the ones not yet applied. Recommended when you want a reviewable SQL history. - Runtime migrate: calling
migrate(db)from application code, described as widely used in monolithic apps and also in serverless setups. - Pull (
drizzle-kit pull): database-first; generates the TypeScript schema from the current database. - Export (
drizzle-kit export): prints SQL so external tools can apply it.
The page does not say whether push and generated migrations can be combined, and it does not name the migrations table. I did not find a maintainer-answered GitHub issue about the combination: open issues such as #3821 (a React Native migration running twice under React strict mode, from a reporter's analysis) and #5274 (migrate failing when a schema already exists) show "already exists" errors have several causes. This thread does not claim a fix for them.
How to choose
1. Throwaway or local database you can recreate: push is fine. 2. Shared, staging or production database: use generate and migrate, commit the SQL, and review it before it runs. 3. Existing database with its own SQL tooling: pull, or export to your tool. 4. Do not switch methods on a database that already has data without a backup and a plan; the docs do not cover that case.
How to describe it to your agent
This project uses Drizzle with Postgres. Use generate and migrate for the shared database and show me the generated SQL before running anything. Never run drizzle-kit push against a database that holds real data. If the schema and migrations disagree, stop and tell me.
Mistakes to check
- Running push on production because it was convenient in development.
- Hand-editing generated SQL files.
- Treating "already exists" as a bug before checking whether the database was changed by another method.
Limits
Drizzle's documentation and the cited issues describe workflows and failure cases, not successful user outcomes or a validated way to mix methods.
Sources
This thread was built from Drizzle's documentation and a quick issue search.
Started from a post by @Drizzle ORM documentation, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.