Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency drizzle-orm to ^0.40.0 #1295

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 27, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
drizzle-orm (source) ^0.38.4 -> ^0.40.0 age adoption passing confidence

Release Notes

drizzle-team/drizzle-orm (drizzle-orm)

v0.40.0

Compare Source

New Features

Added Gel dialect support and gel-js client support

Drizzle is getting a new Gel dialect with its own types and Gel-specific logic. In this first iteration, almost all query-building features have been copied from the PostgreSQL dialect since Gel is fully PostgreSQL-compatible. The only change in this iteration is the data types. The Gel dialect has a different set of available data types, and all mappings for these types have been designed to avoid any extra conversions on Drizzle's side. This means you will insert and select exactly the same data as supported by the Gel protocol.

Drizzle + Gel integration will work only through drizzle-kit pull. Drizzle won't support generate, migrate, or push features in this case. Instead, drizzle-kit is used solely to pull the Drizzle schema from the Gel database, which can then be used in your drizzle-orm queries.

The Gel + Drizzle workflow:

  1. Use the gel CLI to manage your schema.
  2. Use the gel CLI to generate and apply migrations to the database.
  3. Use drizzle-kit to pull the Gel database schema into a Drizzle schema.
  4. Use drizzle-orm with gel-js to query the Gel database.

Here is a small example of how to connect to Gel using Drizzle:

// Make sure to install the 'gel' package 
import { drizzle } from "drizzle-orm/gel";
import { createClient } from "gel";

const gelClient = createClient();
const db = drizzle({ client: gelClient });

const result = await db.execute('select 1');

and drizzle-gel schema definition

import { gelTable, uniqueIndex, uuid, smallint, text } from "drizzle-orm/gel-core"
import { sql } from "drizzle-orm"

export const users = gelTable("users", {
    id: uuid().default(sql`uuid_generate_v4()`).primaryKey(),
    age: smallint(),
    email: text().notNull(),
    name: text(),
});

On the drizzle-kit side you can now use dialect: "gel"

// drizzle.config.ts
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  dialect: 'gel',
});

For a complete Get Started tutorial you can use our new guides:

v0.39.3

Compare Source

  • Remove react from peerDependencies

v0.39.2

Compare Source

  • To be compatible with latest Neon Auth feature we renamed the pre-defined schema internally, from neon_identity to neon_auth - thanks @​pffigueiredo

v0.39.1

Compare Source

  • Fixed SQLite onConflict clauses being overwritten instead of stacked - #​2276
  • Added view support to aliasedTable()
  • Fixed sql builder prefixing aliased views and tables with their schema

v0.39.0

Compare Source

New features

Bun SQL driver support

You can now use the new Bun SQL driver released in Bun v1.2.0 with Drizzle

In version 1.2.0, Bun has issues with executing concurrent statements, which may lead to errors if you try to run several queries simultaneously.
We've created a github issue that you can track. Once it's fixed, you should no longer encounter any such errors on Bun's SQL side

import { drizzle } from 'drizzle-orm/bun-sql';

const db = drizzle(process.env.PG_DB_URL!);

const result = await db.select().from(...);

or you can use Bun SQL instance

import { drizzle } from 'drizzle-orm/bun-sql';
import { SQL } from 'bun';

const client = new SQL(process.env.PG_DB_URL!);
const db = drizzle({ client });

const result = await db.select().from(...);

Current Limitations:

  • json and jsonb inserts and selects currently perform an additional JSON.stringify on the Bun SQL side. Once this is removed, they should work properly. You can always use custom types and redefine the mappers to and from the database.
  • datetime, date, and timestamp will not work properly when using mode: string in Drizzle. This is due to Bun's API limitations, which prevent custom parsers for queries. As a result, Drizzle cannot control the response sent from Bun SQL to Drizzle. Once this feature is added to Bun SQL, it should work as expected.
  • array types currently have issues in Bun SQL.

You can check more in Bun docs

You can check more getting started examples in Drizzle docs

WITH now supports INSERT, UPDATE, DELETE and raw sql template

with and insert

const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
});

const sq = db.$with('sq').as(
    db.insert(users).values({ name: 'John' }).returning(),
);

const result = await db.with(sq).select().from(sq);

with and update

const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
});

const sq = db.$with('sq').as(
    db.update(users).set({ age: 25 }).where(eq(users.name, 'John')).returning(),
);
const result = await db.with(sq).select().from(sq);

with and delete

const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
});

const sq = db.$with('sq').as(
  db.delete(users).where(eq(users.name, 'John')).returning(),
);

const result = await db.with(sq).select().from(sq);

with and sql

const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
});

const sq = db.$with('sq', {
  userId: users.id,
  data: {
    name: users.name,
  },
}).as(sql`select * from ${users} where ${users.name} = 'John'`);

const result = await db.with(sq).select().from(sq);

New tables in /neon import

In this release you can use neon_identity schema and users_sync table inside this schema by just importing it from /neon

// "drizzle-orm/neon"
const neonIdentitySchema = pgSchema('neon_identity');

/**
 * Table schema of the `users_sync` table used by Neon Identity.
 * This table automatically synchronizes and stores user data from external authentication providers.
 *
 * @​schema neon_identity
 * @​table users_sync
 */
export const usersSync = neonIdentitySchema.table('users_sync', {
  rawJson: jsonb('raw_json').notNull(),
  id: text().primaryKey().notNull(),
  name: text(),
  email: text(),
  createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' }),
  deletedAt: timestamp('deleted_at', { withTimezone: true, mode: 'string' }),
});

Utils and small improvements

getViewName util function

import { getViewName } from 'drizzle-orm/sql'

export const user = pgTable("user", {
  id: serial(),
  name: text(),
  email: text(),
});

export const userView = pgView("user_view").as((qb) => qb.select().from(user));

const viewName = getViewName(userView)

Bug fixed and GitHub issue closed


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot enabled auto-merge January 27, 2025 12:26
@renovate renovate bot changed the title fix(deps): update dependency drizzle-orm to ^0.39.0 fix(deps): update dependency drizzle-orm to ^0.39.1 Jan 29, 2025
@renovate renovate bot force-pushed the renovate/drizzle-orm-0.x branch from 397b22c to 0532456 Compare January 29, 2025 18:29
@renovate renovate bot force-pushed the renovate/drizzle-orm-0.x branch from 0532456 to 4b8736e Compare February 6, 2025 00:55
@renovate renovate bot changed the title fix(deps): update dependency drizzle-orm to ^0.39.1 fix(deps): update dependency drizzle-orm to ^0.39.2 Feb 6, 2025
@renovate renovate bot changed the title fix(deps): update dependency drizzle-orm to ^0.39.2 fix(deps): update dependency drizzle-orm to ^0.39.3 Feb 11, 2025
@renovate renovate bot force-pushed the renovate/drizzle-orm-0.x branch from 4b8736e to 6788780 Compare February 18, 2025 01:03
@renovate renovate bot force-pushed the renovate/drizzle-orm-0.x branch from 6788780 to 8dbe461 Compare February 25, 2025 22:12
@renovate renovate bot changed the title fix(deps): update dependency drizzle-orm to ^0.39.3 fix(deps): update dependency drizzle-orm to ^0.40.0 Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants