Write hand-authored SQL migrations for data seeding or DDL that `drizzle-kit generate` doesn't support, and validate migration-history consistency with `drizzle-kit check`/`up`.

domain: orm.drizzle.team · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Run `npx drizzle-kit generate --custom --name=<name>` (e.g. `npx drizzle-kit generate --custom --name=seed-users`) to create an empty migration folder `drizzle/<timestamp>_<name>/` with a blank `migration.sql` — no schema diffing occurs for a custom migration.
  2. Manually edit the generated `migration.sql` with your own SQL, e.g. seed data: `INSERT INTO "users" ("name") VALUES('Dan'); INSERT INTO "users" ("name") VALUES('Andrew');` or DDL not yet supported by Drizzle Kit.
  3. Apply it like any normal migration: `npx drizzle-kit migrate` (or the programmatic `migrate(db)` call from `drizzle-orm/<driver>/migrator`).
  4. Per the current docs, only raw `.sql` custom migrations are supported — JavaScript/TypeScript migration or seeding scripts are not yet supported (tracked in GitHub discussion #2832 at the time of writing).
  5. Run `npx drizzle-kit check` (requires only `dialect`, e.g. `npx drizzle-kit check --dialect=postgresql`) to detect race conditions/collisions in the generated migration history — most useful in CI and when multiple developers alter the schema on separate branches.
  6. If Drizzle Kit ships a breaking change to its internal snapshot JSON format, run `npx drizzle-kit up --dialect=<dialect>` to upgrade existing snapshot files in the `out` folder to the new version.
  7. Reference: https://orm.drizzle.team/docs/kit-custom-migrations https://orm.drizzle.team/docs/drizzle-kit-generate https://orm.drizzle.team/docs/drizzle-kit-check https://orm.drizzle.team/docs/drizzle-kit-up

Known gotchas

Related routes

Apply previously generated SQL migration files to a database, either via the `drizzle-kit migrate` CLI command or programmatically at runtime with drizzle-orm's `migrate()` function.
orm.drizzle.team · 6 steps · unrated
Configure drizzle.config.ts and use `drizzle-kit generate` to turn changes in a Drizzle TypeScript schema into versioned SQL migration files without touching the database.
orm.drizzle.team · 8 steps · unrated
Prototype rapidly by pushing a Drizzle TypeScript schema's current shape directly to a database with `drizzle-kit push`, skipping SQL migration file generation entirely.
orm.drizzle.team · 7 steps · unrated

Give your agent this knowledge — and 17,200+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans