Installation
Available Commands
generate
Generate SQL migration files from your Drizzle schema.Database dialect:
postgresql, mysql, sqlite, turso, or singlestorePath to schema file or folder. Can be a glob pattern.
Output folder for migration files
Custom migration file name
Generate an empty migration file for custom SQL
Enable SQL statement breakpoints in generated migrations. Required for databases that don’t support multiple DDL statements in one transaction (MySQL, SQLite, SingleStore).
Migration file prefix formatOptions:
index, timestamp, supabase, unix, nonePath to config file (default:
drizzle.config.ts)Column name casing for serialization:
camelCase or snake_caseThe
generate command does not execute migrations - it only creates migration files. Use the migrate command to apply migrations to your database.migrate
Apply pending migrations to your database.Path to config file containing database credentials and migration settings
The
migrate command requires database credentials to be configured in your drizzle.config.ts file. It reads migration files from the out directory and applies them in order.- Reads migration files from the configured output directory (default:
drizzle) - Checks the migrations table to see which migrations have been applied
- Applies pending migrations in sequential order
- Records applied migrations in the migrations table
push
Push schema changes directly to the database without generating migration files.Database dialect:
postgresql, mysql, sqlite, turso, or singlestorePath to schema file or folder
Print all SQL statements that will be executed
Always ask for confirmation before applying changes
Auto-approve all data loss statements without confirmation
Path to config file
Database connection URL
Database host
Database port
Database user
Database password
Database name
SSL mode for PostgreSQL:
require, allow, prefer, or verify-fullAuthentication token (for Turso)
Filter tables with glob patterns
PostgreSQL schema name filters
The
push command is ideal for prototyping and development. For production, use generate and migrate to maintain a history of schema changes.pull (introspect)
Introspect an existing database and generate Drizzle schema.Database dialect:
postgresql, mysql, sqlite, turso, singlestore, or gelOutput folder for generated schema files
Path to config file
Casing format for generated schema:
camel or preservecamel: Converts snake_case to camelCasepreserve: Keeps original database casing
Generate migration files with breakpoints
push command.
Example:
schema.ts: Complete Drizzle schema based on your databaserelations.ts: Inferred relations between tables
studio
Launch Drizzle Studio - a visual database browser.Custom port for Drizzle Studio
Custom host for Drizzle Studio
Print all SQL statements executed by Studio
Path to config file containing database credentials
- Browse and edit database records
- Run queries
- View table schemas and relationships
- Real-time data updates
https://local.drizzle.studio
drop
Remove a migration file and update the migration journal.Migrations folder
Path to config file
check
Validate migration files and ensure consistency.Database dialect
Migrations folder
Path to config file
- Migration file syntax
- Migration journal consistency
- Schema snapshot integrity
up
Upgrade migration files to the latest Drizzle Kit format.Database dialect
Migrations folder
Path to config file
This command upgrades migration metadata format when updating Drizzle Kit versions. It preserves your migration SQL while updating internal metadata.
export
Generate SQL diff between current schema and empty state.Database dialect
Path to schema file or folder
Generate output as SQL
Path to config file
Global Options
All commands support:--config: Specify custom config file path- Using environment variables through config file
- Both CLI flags and config file (flags take precedence)
Exit Codes
0: Success1: Error occurred