How does Drizzle handle schema migrations?
How does Drizzle handle schema migrations?
About drizzle-team/drizzle-orm · 2 messages · last activity 7/5/2026
Based on the repository data, Drizzle handles schema migrations through Drizzle Kit, a powerful CLI companion tool.
Migration Approach
Drizzle Kit can handle migrations in two ways:
- Generate SQL migration files — Drizzle Kit generates SQL files that you can review and apply separately
- Apply schema changes directly — It can push schema changes directly to the database
[README.md:L29-L35] states: "Drizzle comes with a powerful Drizzle Kit CLI companion for you to have hassle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database."
Separated Migrations Functionality
In version 0.14.0+, migrations were moved to separate imports for different database systems. For example:
- PostgreSQL:
import { migrate } from 'drizzle-orm-pg/node/migrate';[changelogs/drizzle-orm-pg/0.14.0.md:L1-L9] - SQLite:
import { migrate } from 'drizzle-orm-sqlite/better-sqlite3/migrate';[changelogs/drizzle-orm-sqlite/0.14.1.md:L1-L9]
Dialect-Specific Constraints
Notably, not all dialects support all migration features. For example, with the Gel dialect, Drizzle won't support generate, migrate, or push features—instead, you use the gel CLI to manage migrations and drizzle-kit solely for pulling the schema [changelogs/drizzle-kit/0.30.5.md:L3-L30].
FOLLOW_UPS:
- What migration features does Drizzle Kit support?
- How do you configure drizzle-kit for different databases?
- Can Drizzle rollback migrations automatically?
Want to ask your own question?
Open chat for drizzle-team/drizzle-ormPublic Q&A. Generated by RepoPilot from the actual source of drizzle-team/drizzle-orm. AI answers can be incomplete or stale — verify before relying on them.