Drizzle Team

DT

Drizzle Team

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

Join

GraphQL deeply nested relations

I see https://github.com/drizzle-team/drizzle-graphql/releases/tag/0.7.0 has a depth limit of 2 (and 2nd does not have relations). Is there anyway to make the second have relations / have depth limit of 3 maybe......

Seed local SQLite database from Remote D1 data?

Hi Drizzle team, I've been doing some basic testing of D1 with Drizzle and I've added some data to my remote D1 instance with Drizzle Studio. I see that the updated data is in my remote D1. However, when I migrate and run wrangler dev, I don't see my data in local. What am I missing?

Issue in database loading in the Table section - Drizzle OMR

Dear Drizzle Support Team, I hope you are doing well. My name is Jigisha Rathod, and I am reaching out from India regarding an issue I encountered while using Drizzle OMR. I am facing an error in the Table section of Drizzle OMR....

How to Query Only 2 Tables from a 68-Table Database Using Drizzle for single micro service/function?

Hi Drizzle team, I’m building a microservice that only interacts with 2 tables, while our full database schema has 68 tables. I’d like to keep this microservice code lightweight and not have to include or maintain all 68 tables in my schema definitions. Questions:...

Keyword "with" is not typed

Hello. I need some help here. https://github.com/drizzle-team/drizzle-orm/issues/4297 Any idea why the keyword "with" is not typed...

Non-escape character breaks select function

One of my users has an apostrophe in their name ex: Ty'ler Marshall. They are just using out of the box Supabase email provider magic link functionality with a gmail address. The raw_user_meta_data column is storing their name like: ``` { "sub": "3ecc77d1-0dd178e7206d", "name": "Ty'ler Marshall",...

Consistently hitting max clients/connections on postgres

Hey, I just launched my app 2 days ago, its being hosted on vercel atm. Despite having barely no users (max spike was 34 users/h) I keep getting an error about hitting the max connections allowed on the db. This is a Nextjs app using Drizzle along with Supabase. Only using the supabase client for checking auth, always awaited, and all db queries are done through Drizzle. I am using the transaction pool url and followed the setup on the supabase docs. I will also be posting this on the Supabase discord. ...

Many relations definitions are not supported?

I have a monorepo setup and wanna add specific relations for different microservices, so I have, for instance, apps table, sharedAppRelations, and another appRelations definition in microservice folder, and then I merge shared schema to specific. Expected to have all relations, but types show only shared relations...

How do you guys setup drizzle with next 15?

Apparently it doesnt work anymore, when i put ``` import { drizzle } from "drizzle-orm/postgres-js";...

pgSchemas and BetterAuth

I am trying to integrate better auth and drizzle into a new Elysia app, and had some questions regarding separating schemas in my db. I want to put the users, accounts, verifications, and sessions on an auth schema and the rest on a public schema. Can someone give me a sanity check to make sure I am doing this right?...

Type Error When Using ...companies in Drizzle ORM select()

I'm using Drizzle ORM with PostgreSQL and trying to fetch all columns from the companies table along with a job count. The following code throws a type error (but works at runtime): ```js...

'process is not defined' in Sveltekit SPA

Hi, I have a monorepo (turborepo) and I have my drizzle instance as a package. In my schema I have createInsertSchema I want to use in my frontend to do form validation. The problem is I get the error process is not defined because the code is ran from the client. In FF devtools I see it goes wrong at user: process.platform === 'win32' ? process.env.USERNAME : process.env.USER, (line 8 @ http://localhost:5173/node_modules/pg/lib/defaults.js). Why does it need pg in the first place? I only import the createInsertSchema. Here is the code: /// Database package:...

Right way to completely wipe DB and recreate it

I was just wondering if there is a way to completely overwrite the DB and push my migrations? I'd need this for development, since I sometimes still need to change something in the schemes. They way I went with is deleting the Tables myself or just recreate the Docker container but this can't be it? Couldn't find sth describing exactly this in the Docs. I'm interested in a drizzle-kit CLI way, not programmatically....

Durable Object example weird import

Here in thd docs https://orm.drizzle.team/docs/connect-cloudflare-do There is the following import import migrations from '../drizzle/migrations'; which i dont get? Inside my drizzle folder i have the migration files *.sql and a meta folder. Where does the migrations file come from? ...

Error in Drizzle.studio

I'm having problems to get my drizzle studio up, one day it was working without any problem and the next day I started to get this problem, the versions I have are the following: "drizzle-orm": "0.33.0", "drizzle-kit": "^0.24.0", My configuration is as follows :...
No description

Is there any easy way to query both total count and pagination result?

The official doc shows a simple pagination query with dynamic query: ```ts function withPagination<T extends PgSelect>( qb: T,...

Hitting connection limits using Pgbouncer

I am connecting to my Supabase DB from my NextJS app hosted on Vercel and am pretty consistently hitting the max client connections when using PgBouncer. I have upgraded my Supabase project to use the IPV4 extension so that I can use the dedicated pooler, and I am running an XL DB. I am wondering if I am just initializing the DB incorrectly and am not properly releasing connections to the pooler? I also recently switched to the vercel fluid ocmpute model in hopes of releiving this issue. The postgres url being used is that of the dedicated pooler on port 6543! Curious if I need to update the way I am connecting in order to release connections back to the pooler? Or if my app traffic is just needed a larger DB....

Relationships not working? (Simplest one-one relationship)

I can't seem to have Drizzle return the correct query when using the relationship syntax. I have the following relationship defined: user-schema.ts ``` export const manager = mysqlTable('manager', { userId: varchar('user_id', { length: 36 }).notNull().references(() => user.id, { onDelete: 'cascade' }),...

Can't get Drizzle working in turborepo as package

I can't get Drizzle working as package in turborepo, getting all kind of TS errors. Does anyone have a working example? I am using Sveltekit as the frontend, hono as the backend (with nodeJS) and want to use a message queue worker (BullMQ in my case) too as a seperate app. Both Hono and the message queue will need to access drizzle, thats why I want to use Drizzle as a package....

Resolve drizzle-kit push wanting to truncate tables which do not need to be truncated

Is it possible to fix drizzle-kit push wanting to truncate by tables because it wants to change from bigint(20) to bigint? ``` Warning Found data-loss statements: · You're about to change id column type from bigint(20) to bigint with 1 items...
Next