Recommended Free Tools
For a SvelteKit app whose TypeScript schema is the source of truth, a practical default for production is to run drizzle-kit generate, review and commit the resulting SQL, then apply pending migrations once during deployment with drizzle-kit migrate or a coordinated external runner. Choose drizzle-kit push instead when direct schema synchronization fits your release process and you do not need the same committed SQL review trail. Drizzle documents push for some production patterns too, so it is not inherently a development-only command.
First decide what owns the schema
Drizzle describes two broad directions: codebase-first and database-first. “Schema-first” is often used informally for the codebase-first approach; it is not a separate Drizzle command.
As an Amazon Associate I earn from qualifying purchases.
- Codebase-first: Your JavaScript or TypeScript schema in version control is authoritative. Changes are applied to the database through Drizzle, direct SQL, or another tool. Drizzle says a TypeScript schema can be the source of truth for queries and migrations. Drizzle schema declaration
- Database-first: The live database or an established external migration process is authoritative. Apply changes through that system, then use
drizzle-kit pullto introspect the database and write its schema representation into your codebase. Drizzle migrations
Pick the authority before choosing commands. If an existing database or operations process already owns schema changes, treating TypeScript as an independent authority can leave the database, external migration history, and pulled schema representation out of sync.
Which workflow fits your release?
| Workflow | Source of truth | What you run | Benefit | Trade-off |
|---|---|---|---|---|
| Database-first | Live database or external migration system | Apply changes with the chosen system, then drizzle-kit pull |
Fits teams whose database or established migration process is authoritative. | Keep the database, external migration history, and pulled TypeScript representation aligned. Drizzle migrations |
| Code-first, direct push | TypeScript schema | drizzle-kit push |
Synchronizes the schema without a workflow of generated migration files to manage. | SQL is generated and applied under the hood, but this does not provide the same committed generated-SQL review trail as generate-and-migrate. Drizzle documents push for rapid prototyping and selected production patterns, including blue/green deployment and serverless databases. Drizzle push |
| Code-first, generated migrations | TypeScript schema plus versioned SQL files | drizzle-kit generate, review and commit the SQL, then drizzle-kit migrate |
Creates SQL files that can be inspected and versioned, with migration tracking when applied through Drizzle. | The deployment job must have the migration files and appropriate database credentials. Drizzle generate Drizzle migrate |
| Code-first, externally applied SQL | TypeScript schema plus SQL migrations | Generate SQL with drizzle-kit generate, then apply it with an external migration tool or directly |
Retains generated SQL while letting an operations system execute it. | Coordinate the external runner with Drizzle’s migration-history conventions. Drizzle allows generated files to be applied by external tools or directly. Drizzle migrations Drizzle generate |
What each Drizzle Kit command does
drizzle-kit generate: create migration files
The generator reads the TypeScript schema, creates a JSON schema snapshot, compares it with the prior migration snapshot, and writes a SQL migration and snapshot to the configured output. It can also create a custom migration file for SQL changes or data work that needs manual authoring. Migration files may be applied with drizzle-kit migrate, Drizzle ORM’s migrator, an external migration tool, or direct database execution. Drizzle generate
#1 Best Overall
Generation is not approval: inspect the SQL and decide whether it is appropriate for the change and target database before release.
drizzle-kit migrate: apply pending files
The CLI reads migration SQL files, connects to the database, checks the migration log for entries already applied, applies pending migrations, and records successful applications. The documented defaults are a __drizzle_migrations table and, for PostgreSQL, a drizzle schema; both are configurable. Drizzle migrate
Rank #2
This log makes repeat application aware of previously successful migrations. It does not establish that every database’s DDL is transactional or that all changes can be rolled back automatically; those outcomes depend on the database dialect and SQL statements.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11drizzle-kit push: diff and apply directly
Push builds a snapshot from the TypeScript schema, introspects the database, compares the two, generates SQL, and applies it. The important distinction is the workflow: it does not create the same committed generated-SQL trail as a generate-and-migrate process. Drizzle presents it for rapid iteration and also documents production use cases, so deciding against it should be based on review, history, and deployment needs—not a blanket claim that it is forbidden in production. Drizzle push
Rank #3
drizzle-kit pull: reflect the database in TypeScript
Pull introspects the database and converts its schema into TypeScript. It is the Drizzle path for teams whose database or external migration process is the authority. Drizzle migrations
A production pattern for code-first SvelteKit
- Keep the schema and configuration in the repository. Configure the SQL dialect, schema path, output directory, and credentials for the database that will receive the migration. Drizzle Kit needs to import the exported models it will diff. Schema declaration Generate
- Generate migrations for schema changes. Run
drizzle-kit generatein the environment where the configured schema and migration snapshots are available. - Review and commit the SQL and snapshots. Check the SQL against the intended change, then keep the migration artifacts with the application change so the release process can access the files.
- Apply migrations once as part of a controlled release. Run
drizzle-kit migratein a deployment job or other suitable deployment-time resource with production database credentials, or use a coordinated external runner. Drizzle documents deployment-time patterns, but does not prescribe one CI product or SvelteKit adapter recipe. Drizzle migrations Drizzle migrate - Deploy or route application instances according to the schema change. Consider compatibility between the deployed application and database schema as part of the host’s release strategy. Drizzle discusses zero-downtime deployment patterns, but there is no universal SvelteKit rollout sequence in the cited guidance. Drizzle migrations
What SvelteKit does—and does not—determine
SvelteKit does not by itself select the right migration executor. The migration runner needs the right database dialect and credentials, and the deployed environment must be able to find the migration SQL files. Adapter and host packaging, runtime, and deployment-job details vary, so confirm them in the current documentation for the adapter and platform you use. Drizzle’s guidance supports deployment-time execution patterns, not a universal instruction to put migrations in every request path. Drizzle migrations Drizzle migrate Drizzle private Railway database tutorial
Quick Recap
Best Value
Make the choice by the operational need
- Choose generate, review, and migrate when you want committed SQL, an inspectable change history, and a distinct deployment step.
- Choose push when direct synchronization fits your team’s process and omitting generated migration files is an intentional trade-off; Drizzle documents some production uses.
- Choose database-first with pull when the database or an existing external migration system owns schema changes.
- Regardless of executor, agree on which system is authoritative and how migration history is tracked.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




