List of commands
Generate migrations
drizzle-kit generate:{dialect}
lets you generate migrations based on you Drizzle schema.
param | required | description |
---|---|---|
schema | yes | path to typescript schema file or folder with multiple schema files |
out | no | migrations folder, default=./drizzle |
config | no | config file path, default=drizzle.config.ts |
custom | no | generate empty SQL for custom migration |
breakpoints | no | SQL statements breakpoints, default=true |
If you want to use custom named config file
If you want to have all params as CLI options
Generate an empty SQL migration file for custom migration.
Introspect / Pull
drizzle-kit introspect:{dialect}
command lets you pull DDL from existing database and generate schema.ts
file in matter of seconds.
Either connectionString
or user:password@host:port/db
params are mandatory.
param | required | description |
---|---|---|
driver | yes | driver to use for querying (mysql2 , better-sqlite , libsql , turso ) |
out | no | migrations folder, default=./drizzle |
connectionString | no | database connection string |
user | no | database user |
password | no | database password |
host | no | host |
port | no | port |
database | no | database name |
config | no | config file path, default=drizzle.config.ts |
introspect-casing | no | strategy for JS keys creation in columns, tables, etc. (preserve , camel ) |
schemaFilter | no | Schema name filter. Default: ["public"] |
If you want to use custom named config file
If you want to have all params as CLI options
Prototype / Push
drizzle-kit push:{dialect}
lets you push your schema changes directly to the
database and omit managing SQL migration files.
This has proven to be very useful for rapid local development(prototyping) and when working with remote databases like Planetscale, Neon, Turso and others.
Extended article on Turso and drizzle-kit push — read here.
Either connectionString
or user:password@host:port/db
params are required.
param | required | description |
---|---|---|
schema | yes | path to typescript schema file or folder with multiple schema files |
driver | yes | driver to use for querying (mysql2 , better-sqlite , libsql , turso ) |
tablesFilter | no | table name filter |
schemaFilter | no | Schema name filter. Default: ["public"] |
connectionString | no | database connection string |
user | no | database user |
password | no | database password |
host | no | host |
port | no | port |
database | no | database name |
config | no | config file path, default=drizzle.config.ts |
verbose | no | print all queries that will be executed |
strict | no | always ask for an approve before pushing the schema |
If you want to use custom named config file
If you want to have all params as CLI options
Drop migration
drizzle-kit drop
lets you delete previously generated migrations from migrations folder
Please don’t delete any files in migrations folder manually, it might break drizzle-kit
param | required | description |
---|---|---|
out | no | migrations folder, default=./drizzle |
config | no | config file path, default=drizzle.config.ts |
If you want to use custom named config file
If you want to have all params as CLI options
Maintain stale metadata
We’re rapidly evolving Drizzle Kit APIs and from time to time there’s a need to upgrade underlying metadata structure.
drizzle-kit up:{dialect}
is a utility command to keep all metadata up to date.
param | required | description |
---|---|---|
out | no | migrations folder, default=./drizzle |
config | no | config file path, default=drizzle.config.ts |
If you want to use custom named config file
If you want to have all params as CLI options
Check
drizzle-kit check:{dialect}
is a very powerful tool for you to check consistency of your migrations.
That’s extremely useful when you have multiple people on the project, altering database schema on different branches.
Drizzle Kit will check for all collisions and inconsistencies.
param | required | description |
---|---|---|
out | no | migrations folder, default=./drizzle |
config | no | config file path, default=drizzle.config.ts |
If you want to use custom named config file
If you want to have all params as CLI options
Drizzle Studio [NEW]
drizzle-kit studio
lets you launch Drizzle Studio database browser locally from you config file.
param | required | description |
---|---|---|
port | no | custom port |
verbose | no | log all sql statements |