github drizzle-team/drizzle-orm v1.0.0-beta.2
1.0.0-beta.2

pre-release4 hours ago

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!

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

[WIP]

Full drizzle-kit rewrite

Architecture rewrite that will close major kit and migration issues. We've done a set of very valuable and needed updates to iterate faster, having better test coverage, etc.

The work that was done:
[WIP]

Bugs fixed

Updates and Fixes

  • Fixed pg-native Pool detection in node-postgres transactions
  • Allowed subqueries in select fields
  • Updated typo algorythm => algorithm
  • Fixed $onUpdate not handling SQL values (fixes #2388, tests implemented by L-Mario564 in #2911)
  • Fixed pg mappers not handling Date instances in bun-sql:postgresql driver responses for date, timestamp types (fixes #4493)

Don't miss a new drizzle-orm release

NewReleases is sending notifications on new releases.