WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Releases: drizzle-team/drizzle-orm

0.45.0

04 Dec 15:21
c445637

Choose a tag to compare

  • 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)

[email protected]

04 Dec 15:21
c445637

Choose a tag to compare

Bug fixes

  • Fixed algorythm => algorithm typo.
  • Fixed external dependencies in build configuration.

1.0.0-beta.2

02 Dec 21:19
378b043

Choose a tag to compare

1.0.0-beta.2 Pre-release
Pre-release

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: #2832

We've updated the migrations folder structure by:

  • removing journal.json
  • grouping SQL files and snapshots into separate migration folders
  • removing the drizzle-kit drop command

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: #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:

  • Migrated from database snapshots to database DDL snapshots
  • Reworked the entire architecture for detecting and applying diffs
  • Added significant improvements for defaults, expressions, and types detection
  • Reduced schema introspection time from 10 seconds to under 1 second by minimizing database calls and query complexity
  • Added query hints and explain support for push
  • Expanded test coverage - each test case now runs up to 6 different scenarios (e.g., push+push, pull+generate, etc.)

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

  • 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)

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

Read more

[email protected]

17 Nov 11:51
47ba9c8

Choose a tag to compare

[email protected]

28 Oct 12:48
ad4ddd4

Choose a tag to compare

0.44.7

23 Oct 18:11
11ff664

Choose a tag to compare

0.44.6

02 Oct 09:49
a9136ee

Choose a tag to compare

  • feat: add $replicas reference #4874

[email protected]

26 Sep 12:47
8e8a9e9

Choose a tag to compare

  • Add casing support to studio configuration and related functions

0.44.5

25 Aug 14:30
37d059f

Choose a tag to compare

  • Fixed invalid usage of .one() in durable-sqlite session
  • Fixed spread operator related crash in sqlite blob columns
  • Better browser support for sqlite blob columns
  • Improved sqlite blob mapping

0.44.4

29 Jul 09:22
8b8d78e

Choose a tag to compare