Drizzle Team

DT

Drizzle Team

The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!

Join

An example from the docs is marked as deprecated.

Hello, I'm using postgres and my pgTable calls are being shown as "deprecated", as well as the example in the docs. ```ts const table = pgTable('table', { id: integer('id'),...

Can I re-use my Prisma Migrations on Drizzle?

I'm migrating a project from Prisma to Drizzle, I already have a migrations folder with some migrations there. Can I have Drizzle port/convert those migrations to itself?

Is there a type for a Drizzle connection?

My use case is the following: I'm building a library dealing with a Neon database, but the connection shoud be created by the app using the library. So, all the functions of the lib expects as a their first parameter the actual connection to the database. How can I type this parameter so that the function accepts both a connection created with the Neon HTTP and Websockets drivers? Neon HTTP driver ```typescript...

composite primary key approach shows deprecate

Hi, if I follow this approach: https://orm.drizzle.team/docs/indexes-constraints#composite-primary-key to create a primary key. I get a depecrated notification....

Conditional batch on Neon Batch API?

Hi, it's possible to do something like: ```typescript const deleteImages = true // can be true or false await db.batch([...

Setting up drizzle.config.ts for AWS

For the life of me, I cannot figure this out. ```ts import { defineConfig } from "drizzle-kit" export default defineConfig({...

Help Setting up Driver w/ AWS RDS

I'm following the instructions here directly https://orm.drizzle.team/docs/connect-aws-data-api-pg But, this instance of drizzle is unfound....
Solution:
The documentation is incorrect, it should be import { drizzle } from "drizzle-orm/aws-data-api/pg"
No description

typeof table.$inferInsert isn't returning all properties?

I upgraded from .31.2 to .36 today, and now I'm getting type errors. I think this image explains it best, but what I have is a calendar schema. I have a NewCalendar type but as you can see it is only picking up the user_id and nothing else. This means that any insert/update I'm trying to do it failing because I'd be trying to set summary, for example, and it isn't on the type. I looked through the release notes and didn't see anything about this. Any ideas?...
No description

A way to make a custom type generatedAlwaysAsIdentity

I've tried the following ways to achive this, but none of them work.
id: customId("id").primaryKey().generatedAlwaysAs(sql`IDENTITY`)
id: customId("id").primaryKey().generatedAlwaysAs(sql`IDENTITY`)
...

RLS - Typesafety

I noticed in the docs the created RLS client doesn't have your schema passed to it, meaning you wouldn't be able to use dbClient.query - docs here: https://orm.drizzle.team/docs/rls Is there a reason for this? In my testing, if you pass the same Database type your usual client returns, you get full functionality. This might just be a docs miss, but want to be sure in case this was done this way for a reason!...

drizzle-kit push keeps trying to drop and recreate the same constraints

``` │ALTER TABLE "authenticator" DROP CONSTRAINT authenticator_userId_credentialID_pk; │--> statement-breakpoint │ALTER TABLE "authenticator" ADD CONSTRAINT authenticator_userId_credentialID_pk PRIMARY KEY(userId,credentialID); │ALTER TABLE "account" DROP CONSTRAINT account_provider_providerAccountId_userId_pk;...

Using Zod objects generated from drizzle zod with ts-rest . Parameters interpreted as optional

Hey I am trying to use drizzle zod to generate zod objects to be used in my ts rest contract. however when I try to use this contract in my handlers the fields in the body being passed are interpreted as being optional and not mandatory contract ```...

TypeError: Cannot read properties of undefined (reading 'isRLSEnabled')

TypeError: Cannot read properties of undefined (reading 'isRLSEnabled') I am getting this error when using Drizzle kit push I am using Supabase. I recently updated the Drizzle Orm and Drizzle Kit and I was not getting this error before the update....

Deprecated pgTable signature

I'm seeing this as deprecated, but not clear on what the correct / up to date usage should be: ``` export const providerServiceAreas = pgTable( "provider_service_areas",...

database design suggestions

i am creating a minimal issue tracker application, the user flow is as follows: - user signs in (passwordless auth) - creates a username (if signing in first time) - creates a project - creates custom priority levels...
No description

Help with relations: many-to-many + one-to-one

I'm having trouble figuring out how to model the following relationships between papers, authors, and author's names with Drizzle relations. The schema looks like this (I've ommitted some columns for brevity) ```ts export const authors = sqliteTable("authors", (t) => ({ authorId: t.integer().primaryKey(),...

Possible to infere type from PgEnum?

how to get the type of something like this export const serenity = pgEnum("serenity", ["ok", "warning", "critical", "error"])...

Are hierarchical rows possible?

Would it be possible to do something like this?
No description

is there a way to use custom functions without raw sql?

i'm using functions from a postgres extension. is there a way to use them in queries without baking in raw sql?