Changes in v1

This page shows everything that changed from drizzle-orm@0.x, drizzle-kit@0.x, drizzle-seed@0.x to the latest drizzle-orm@1.0, drizzle-kit@1.0, drizzle-seed@1.0

Read more on how to upgrade here

Breaking changes

Foreign key handling in pre-v1.0

The old drizzle-kit didn’t pass FK names from TS schema through to generated SQL:

export const table = sqliteTable("table", {
  column1: integer(),
  column2: integer(),
}, (t) => [
  foreignKey({
    name: "name",
    columns: [t.column1],
    foreignColumns: [t.column2],
  }),
]);
-- Before: no name in generated SQL
CREATE TABLE `table` (
	`column1` integer,
	`column2` integer,
	FOREIGN KEY (`column1`) REFERENCES `table`(`column2`) ON UPDATE no action ON DELETE no action
);

On introspect, drizzle-kit parses DDL to find the constraint name; if none is found, the default name is used.

After upgrading to v1, the first push will produce a diff that recreates the table (DB has no name, TS does). To avoid this, remove the FK name from the TS schema - no diff will be generated.

drizzle-kit generate behaves as expected; no changes needed.

Relational filters reject explicit undefined

In Relational Queries v2, omit an optional filter field or use EmptyFilter from drizzle-orm/relations. Passing undefined explicitly throws. An empty relation filter such as where: { posts: {} } is skipped. Use posts: true to require related rows and posts: false to require their absence.

See the filter migration examples, especially if you are upgrading from an earlier v1 release candidate.

Read replicas require explicit routing

With withReplicas(primary, replicas), queries use the primary database by default. In 0.x, reads such as select() and db.query were routed to a replica automatically. Use db.$replica for reads you want to send to a replica:

// After: drizzle-orm@rc, with db created by withReplicas()
await db.select().from(users); // primary
await db.$replica.select().from(users); // replica

Query errors omit parameters by default

DrizzleQueryError no longer includes query parameters by default. Set paramsInErrors: true in your drizzle() configuration if you need them for debugging. This also includes parameter values in the error message, so consider what your error logs retain.

Relational Queries v1 removed

RQBv1 has been removed. Use Relational Queries v2 with the new defineRelations() API instead and new features. You can find more details about migrating from rqb v1 to v2 here

A new relations system built around defineRelations():

import { defineRelations } from 'drizzle-orm';
import * as schema from './schema';

const relations = defineRelations(schema, (r) => ({
  users: {
    posts: r.many.posts(),
  },
  posts: {
    author: r.one.users({
      from: r.posts.authorId,
      to: r.users.id,
    }),
  },
}));

SQLite proxy uses an executor object

Replace the drizzle(callback, config) or drizzle(callback, batchCallback, config) setup with drizzle(executors, config). The executor object requires run, all, and get, and optionally accepts batch.

The return type of your run executor determines the database’s run-result type.

SQLite get() can return undefined

Handle an absent row when using db.get(sql). The SQLite proxy get result is also a single row or undefined, rather than an array of rows.

New Casing API

The legacy drizzle({ casing: 'camelCase' }) has been replaced with a table/view/schema-level API:

import { snakeCase, camelCase, integer, text } from 'drizzle-orm/sqlite-core';

export const users = snakeCase.table('users', {
  id: integer().primaryKey(),
  fullName: text(),        // → full_name in DB
  createdAt: integer({ mode: 'timestamp' }), // → created_at in DB
});

// Available on all entity types:
snakeCase.table / snakeCase.view
camelCase.table / camelCase.view

Validator packages consolidated into drizzle-orm

IMPORTANT

You can still use drizzle-zod/valibot/typebox/arktype validation packages but all new update will be added to Drizzle ORM directly

.generatedAlwaysAs() only accepts SQL

// ❌ Before — accepted raw values
.generatedAlwaysAs('some expression')

// ✅ After — only sql`` or () => sql``
.generatedAlwaysAs(sql`some expression`)
.generatedAlwaysAs(() => sql`some expression`)

getTableColumns deprecation

Use getColumns instead

// ❌ Before
import { getTableColumns } from 'drizzle-orm';

const columns = getTableColumns(users);

// ✅ After
import { getColumns } from 'drizzle-orm';

const columns = getColumns(users);

New migration folder structure (v3)

Linked discussion: #2832


These changes eliminate potential Git conflicts with the journal file and simplify the process of dropping or fixing conflicted migrations

Read more on how to upgrade here

drizzle-kit push --strict deprecation

The --strict flag has been removed — its behavior is now the default. drizzle-kit push always prompts for confirmation for data-loss statements unless the --force flag is passed. Use drizzle-kit push —explain to preview the SQL that would be executed before running it.

Drizzle seed: UUID generator upgraded to v4

The UUID generator now produces RFC 4122 v4 compliant UUIDs, ensuring compatibility with Zod v4 validation. Use { version: '1' } to keep old behavior, or { version: '2' | '3' } for newer generators.

Other features

Drizzle Kit for scripts and agents

If you use a coding agent for the upgrade, Drizzle Kit provides two ways to help it work with your project:

You can use them together, or use the skill with the CLI. After setup, try:

Use the Drizzle skill to check this project's migration history.
Use the Drizzle MCP server if connected. Explain any conflicts or warnings
before changing files or applying anything to the database.

Use --output json with generate, push, pull, up, export, or check to receive a structured response. JSON mode is non-interactive. When a command needs a rename or data-loss decision, provide it through --hints or --hints-file and run the command again.

The programmatic SDK exposes these operations from drizzle-kit, with exportSql() for export.

Relational query ordering and caching

Relational Queries v2 can order by related rows, including aggregates such as orderBy: { posts: 'desc(count)' }. Both object and callback forms of orderBy are supported. See ordering by relations.

When a cache is configured with the all strategy, relational queries are cached by default. Set withCache: false on a query to opt out, or withCache: true to opt in with an explicit cache strategy.

JIT Mappers (opt-in)

Just-in-time compiled row mappers that make mapping as fast as the raw driver. You can find out more here

const db = drizzle({ ..., jit: true });

New MSSQL dialect

New MSSQL dialect support added. You can read more here

New CockroachDB dialect

New CockroachDB dialect support added. You can read more here

Column aliases via .as()

You can find out more aliasing info here

const query = db
  .select({ age: users.age.as('ageOfUser'), id: users.id.as('userId') })
  .from(users)
  .orderBy(asc(users.id.as('userId')));

drizzle-kit pull --init

Creates the drizzle migration table and marks the first pulled migration as applied. You can read more here

drizzle-kit push --explain

Shows the SQL that would be executed without actually running it. You can read more here

drizzle-kit check — commutativity check

Detects non-commutative migrations across branches — e.g., two branches altering the same column, or one renaming a table that another is altering.

How it works:

If conflicts are found, the report tells you exactly which migrations on which branches are incompatible and which statements collide.

drizzle-kit --ignore-conflicts flag

Bypasses commutativity checks when you know the conflicts are expected.

drizzle-kit generate: migration conflict detection

drizzle-kit generate now identifies incompatible changes across migration branches. Use --ignore-conflicts to bypass.

Updates to the migration table

The migration table is automatically upgraded when you run drizzle-kit up. Two new columns are added:

ColumnTypev0v1
idintegeryesyes
hashtextyesyes
created_atnumericyesyes (legacy)
nametext—new
applied_attext—new

Migrations are now matched by their full folder name instead of timestamps. Even if two migrations are generated within the same second, the name suffix guarantees uniqueness.

During the upgrade, existing rows are backfilled using a multi-step strategy:

  1. Millis match — truncate stored millis to seconds, match against local folder timestamps
  2. Hash tiebreaker — if multiple migrations share the same second, disambiguate via the SQL hash
  3. Hash-only fallback — if millis matching fails entirely, match by hash alone

This means the upgrade handles all edge cases: normal single-developer projects, teams with closely-timed migrations, and even cases where the old journal data doesn’t perfectly align with the new folder names.

Migrator applies all missing migrations

Previously the migrator only looked for local migrations with a creation date later than the last applied one. Now it detects and applies every missing migration, regardless of timestamp ordering. All migrations are matched against the full folder name (14-digit UTC timestamp + name suffix).

Top-level await in drizzle config files

Top-level await is now supported in drizzle.config.ts and schema files on Node.js.

Drizzle-kit: Build system improvements

TS Schema file processing

Only files with the following extensions are processed: .js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx. All other file types are ignored.

Drizzle Seed: Ignore columns in refinements

Skip specific columns during seeding — the database default will be used instead:

await seed(db, schema).refine((f) => ({
  users: {
    count: 5,
    columns: {
      name: f.fullName(),
      photo: false, // skip — DB default will be used
    },
  },
}));

min / max parameters

Time-based generators now accept boundaries:

funcs.time({ min: '13:12:13', max: '15:12:13' })
funcs.timestamp({ min: '2024-01-01T00:00:00Z', max: '2025-01-01T00:00:00Z' })
funcs.datetime({ min: '2024-01-01', max: '2025-01-01' })