Drizzle ORM and Drizzle Kit v1.0.0-beta.2 release
Feb 12, 2025

We’ve introduced a lot of changes in this version, and something will definitely break. If anything goes wrong, you can either downgrade to version 1.0.0-beta.1 or 0.44.7, and please report any issues on GitHub or our Discord!

Don’t forget to check 1.0.0-beta.1 release notes as well: https://github.com/drizzle-team/drizzle-orm/blob/beta/changelogs/drizzle-orm/1.0.0-beta.1.md

Check the migration guide for RQBv1 to RQBv2 migration steps: https://orm.drizzle.team/docs/relations-v1-v2

Check new RQBv2 schema docs: https://orm.drizzle.team/docs/relations-v2

Check new RQBv2 query docs: https://orm.drizzle.team/docs/rqb-v2

New Features

MSSQL dialect

Drizzle now supports MSSQL in drizzle-orm, drizzle-kit and drizzle-seed packages. It support most of the columns, query builder capabilities, migration strategies, etc.

The only feature that is not yet supported is RQBv2

// Make sure to install the 'mssql' package 
import { drizzle } from 'drizzle-orm/node-mssql';

const db = drizzle(process.env.DATABASE_URL);
 
const result = await db.execute('select 1');
// Make sure to install the 'pg' package 
import { drizzle } from 'drizzle-orm/node-mssql';

// You can specify any property from the mssql connection options
const db = drizzle({ 
  connection: { 
    connectionString: process.env.DATABASE_URL,
    ssl: true
  }
});
 
const result = await db.execute('select 1');

CockroachDB dialect

Drizzle now supports MSSQL in drizzle-orm, drizzle-kit and drizzle-seed packages. It support most of the columns, query builder capabilities, migration strategies, etc.

The only feature that is not yet supported is RQBv2

// Make sure to install the 'pg' package 
import { drizzle } from 'drizzle-orm/cockroach';

const db = drizzle(process.env.DATABASE_URL);
 
const result = await db.execute('select 1');
// Make sure to install the 'pg' package 
import { drizzle } from 'drizzle-orm/cockroach';

// You can specify any property from the node-postgres connection options
const db = drizzle({ 
  connection: { 
    connectionString: process.env.DATABASE_URL,
    ssl: true
  }
});
 
const result = await db.execute('select 1');

Relational Query Parts

In a case you need to separate relations config into several parts you can use defineRelationsPart helpers

import { defineRelations, defineRelationsPart } from 'drizzle-orm';
import * as schema from "./schema";
export const relations = defineRelations(schema, (r) => ({
  users: {
    invitee: r.one.users({
      from: r.users.invitedBy,
      to: r.users.id,
    }),
    posts: r.many.posts(),
  }
}));
export const part = defineRelationsPart(schema, (r) => ({
  posts: {
    author: r.one.users({
      from: r.posts.authorId,
      to: r.users.id,
    }),
  }
}));

and then you can provide it to the db instance

const db = drizzle(process.env.DB_URL, { relations: { ...relations, ...part } })

Folders v3 migrations

Linked discussion: https://github.com/drizzle-team/drizzle-orm/discussions/2832

We’ve updated the migrations folder structure by:

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

In upcoming beta releases, we’ll introduce commutativity checks to help guide you through team migration conflicts, detect possible collisions, and suggest ways to resolve them

Commutativity discussion: https://github.com/drizzle-team/drizzle-orm/discussions/5005

To migrate previous folders to a new format you would need to run

drizzle-kit up

Full drizzle-kit rewrite

Architecture rewrite to close major kit and migration issues. We’ve completed a set of valuable and necessary updates to help us iterate faster, improve test coverage, and enhance overall stability.

Summary of work completed:

Added drizzle-kit pull --init

This flag will create a drizzle migration table in the database and will mark first pulled migration as applied, so you can contrinue iterating from there

schemaFilter behavior update

drizzle-kit will start managing all the schemas defined in your code. If you want to filter them, you can use schemaFilter Previously, only the public schema was managed unless you explicitly added more schemas to schemaFilter.

It now also supports glob patterns, allowing you to filter schemas in any way you like

.enableRLS() deprecation

Previously to mark PostgreSQL table with RLS enabled you would need to:

// OLD syntax
pgTable('name', {}).enableRLS()

We moved this option to a different place

pgTable.withRLS('users', {});

Alias directly on columns

You can now add as alias to the column in a simple way:

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

MySQL new column types

We’ve added a few more MySQL column types:

More Updates and Fixes

Bugs fixed

This list is not full, we just had a time to get through some of the issues. This list will be updated through the next few weeks