Installation
Available Commands
generate
Generate SQL migration files from your Drizzle schema.string
required
Database dialect:
postgresql, mysql, sqlite, turso, or singlestorestring
Path to schema file or folder. Can be a glob pattern.
string
default:"drizzle"
Output folder for migration files
string
Custom migration file name
boolean
default:false
Generate an empty migration file for custom SQL
boolean
default:true
Enable SQL statement breakpoints in generated migrations. Required for databases that don’t support multiple DDL statements in one transaction (MySQL, SQLite, SingleStore).
string
default:"index"
Migration file prefix formatOptions:
index, timestamp, supabase, unix, nonestring
Path to config file (default:
drizzle.config.ts)string
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.string
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.string
required
Database dialect:
postgresql, mysql, sqlite, turso, or singlestorestring
required
Path to schema file or folder
boolean
default:false
Print all SQL statements that will be executed
boolean
default:false
Always ask for confirmation before applying changes
boolean
default:false
Auto-approve all data loss statements without confirmation
string
Path to config file
string
Database connection URL
string
Database host
string
Database port
string
Database user
string
Database password
string
Database name
string
SSL mode for PostgreSQL:
require, allow, prefer, or verify-fullstring
Authentication token (for Turso)
string
Filter tables with glob patterns
string
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.string
required
Database dialect:
postgresql, mysql, sqlite, turso, singlestore, or gelstring
default:"drizzle"
Output folder for generated schema files
string
Path to config file
string
default:"camel"
Casing format for generated schema:
camel or preservecamel: Converts snake_case to camelCasepreserve: Keeps original database casing
boolean
default:true
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.number
default:4983
Custom port for Drizzle Studio
string
default:"0.0.0.0"
Custom host for Drizzle Studio
boolean
default:false
Print all SQL statements executed by Studio
string
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.string
default:"drizzle"
Migrations folder
string
Path to config file
check
Validate migration files and ensure consistency.string
required
Database dialect
string
default:"drizzle"
Migrations folder
string
Path to config file
- Migration file syntax
- Migration journal consistency
- Schema snapshot integrity
up
Upgrade migration files to the latest Drizzle Kit format.string
required
Database dialect
string
default:"drizzle"
Migrations folder
string
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.string
required
Database dialect
string
required
Path to schema file or folder
boolean
default:true
Generate output as SQL
string
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