Rapidly test schema designs
Local schema experimentation
Drizzle ORM · Command
drizzle-kit push synchronizes a Drizzle schema directly with a database without writing SQL migration files. It is intended for fast, code-first schema iteration.
Drizzle Kit reads the TypeScript schema, introspects the database, compares both representations, creates the required SQL changes internally, and applies them directly. It does not leave generated SQL migration files, so it is suited to a code-first workflow.
npx drizzle-kit push [options]| Name | Type | Description |
|---|---|---|
dialect | string | Database dialect, such as postgresql, mysql, sqlite, turso, singlestore, mssql, or cockroach. |
schema | string | TypeScript schema file or directory; multiple files can be supplied through a glob. |
url | string | Database connection URL. |
connection options | object | Alternative connection fields: user, password, host, port, and database. |
tablesFilter | string | Optional table-name filter. |
config | string | Optional configuration-file path; defaults to drizzle.config.ts. |
Applies the required schema changes to the database; no SQL migration files are generated.
npx drizzle-kit push --dialect=postgresql --schema=./src/schema.ts --url=postgresql://user:password@host:port/dbnamePushes the schema defined in the specified TypeScript file to the PostgreSQL database.
Local schema experimentation
Code-first development
Configured multi-database projects
The command compares the declared Drizzle schema with the live database schema and applies the required SQL changes directly. It skips producing migration files, which makes it convenient for rapid code-first iteration.
Follow-up: How would you handle production schema changes? Generate migration files, review them, and apply them through the deployment process rather than relying on direct push synchronization.
At minimum, the command needs a database dialect, schema path, and connection information. These can be supplied through drizzle.config.ts or as command-line options.
Follow-up: What could happen if the schema glob omits a schema file? Drizzle Kit may compare an incomplete declared schema and produce an incorrect synchronization plan, so all relevant files should be included.
Push does not generate migration files first; it builds an internal schema snapshot, introspects the database, derives SQL from the differences, and applies that SQL. This differs from generate, which creates migration files without applying them.
Follow-up: Why can push be risky in a shared environment? Direct synchronization bypasses a reviewed migration-file workflow and can make destructive or unintended changes harder to audit.
drizzle.config.tsdrizzle-kit generatedrizzle-kit migrateDrizzle Kit