Drizzle Team

DT

Drizzle Team

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

Join

Check

Hello there, from this discussion: https://discord.com/channels/1043890932593987624/1090486363251544124/1093092996200796200 Is it the way to add check constraint? ```ts...

cascades

I know you can add .references() to set up foreign keys in a table definition, but how do you set up cascades?

jsonb field definition.

What's the right way to define a jsonb field? I have a type type MetaData = {keywords?: string[];} and a field meta: jsonb<MetaData>("meta"), but I'm getting the typescript warnings Type 'PgJsonbBuilderInitial<MetaData>' is not assignable to type 'AnyPgColumnBuilder'.ts(2322) on the lhs and Type 'MetaData' does not satisfy the constraint 'string'.ts(2344) on the rhs. Thanks in advance.

"Extend" tables by other tables

Hey all, first of all great work with drizzle. Haven't had the time to play around with it so far. But just from how I currently use other orms. I have an AbstractEntity "class" which isn't an actual db table, but shares the common column each table should have e.g. a unique id. Basically like a parent class, but for DB tables....

maximum call stack exceeded

Weird bug where whenever I add a where eq clause getting maximum call stack exceeded

Drizzle recommended way to migrate reset

Apologies if this is a stupid question, I just recently migrated out of prisma and into drizzle. One of our common use cases for the dev DB was to run yarn prisma migrate reset when we wanted to reset our DB. Is there a drizzle equivalent way to do that?...

compound uniqueIndex

In Prisma, I have in my schema definition the following declaration that requires userId and timestamp tuple to be unique:
@@unique([userId, time])
@@unique([userId, time])
...

planetscale: how to index col using drizzle?

Hi, seems most of the samples are pg. I'm using planetscale, and no having any luck figuring out how to index a col. here's simple table I'm wanting to use to test/eval: ``` import { varchar,...

[Bug?] Drizzle generates a broken query when passing an explicit value for a column as `undefined`

I've translated most of my logic from Prisma usage -> Drizzle. Noticed an issue where when explicitly passing attributes as undefined while inserting, drizzle generates a SQL query like:
sql .... SET exampleProperty = ,
sql .... SET exampleProperty = ,
which throws a syntax error during runtime...

Help improving my query

If feel like this is far from how what it actually should look like in drizzle could I get some pointers what I can improve

Left join with JSON

I'm using PlanetScale (MySQL) and have 2 tables: orders and products. Every order contains basic info about the ordered products (see screenshot). Is there a way to do this?: ```ts...

drizzle bug won't let me update mysql table

wrote a bug ticket on github describing the bug but just wanted to post here as well for visibility https://github.com/drizzle-team/drizzle-orm/issues/364 I think its because of reserved words in the table name...

Generated Collate value

Not sure if this is relevant but I'm translating a Prisma schema into drizzle. Every Prisma table had COLLATE utf8mb4_unicode_ci; added to the generated MySQL. One of my drizzle tables instead has COLLATE utf8mb4_0900_ai_ci; I'm not good enough at dbs/sql to know if this is important, a bug, or irrelevant...

Can I know when I can use Mysql proxy driver?

Hi, I’m Daun and I’m a huge fan of drizzle. i’m really grateful that drizzle is open source and have this wonderful community. Im just curious if I can know when can I use Mysql proxy driver. It’s okay if it takes long or hard to estimate but it’ll definitely help us to make far better technical stack decision (This specific feature is very essential to us at the moment)...

Mocking database

I want to mock the PostgreSQL database and access it with Drizzle ORM. I tried to write a TypeScript class that should work the same way as pg's Pool class, but instead of hitting an actual database, returns rows from an in-memory object. However when SELECT'ing from the table I had mocked, Drizzle returned an object with all keys having undefined values. Any help? 🙂 ```typescript...

What does MySQL bigint config mode do?

In a mysql schema, when creating a bigint, it wants a config object with a mode key where mode could be number. What does this do?...

MySQL unique constraint

In the drizzle schema, is there a way to label a column with unique constraint in mysql? I'm only seeing uniqueIndex

Error querying planetscale db

Trying to get setup with drizzle and running into this error. There's not much info here so I'm not sure how to debug it ``` TypeError: fetch failed at fetch (/home/kelby/work/jobs_fe/node_modules/undici/index.js:113:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)...

db push connection error

getting the following error on my first db push attempt ``` Ignoring invalid configuration option passed to Connection: sslaccept. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection /home/kelby/work/jobs_fe/node_modules/drizzle-kit/index.js:43680 const createConnectionErr = new Error();...