Drizzle Team

DT

Drizzle Team

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

Join

⚠ Error - Top-level await is currently not supported with the "cjs" output format

I am trying to migrate to mysql database. I have already defined the schema and generated the migration files. But I try to migrate, I am getting this weird error - ```js PS D:\Typescript\drizzle orm\drizzle_test> npm run db:migrate
drizzle_test@0.1.0 db:migrate...

Nullable columns doesn't show up while doing inserts

This is my database schema ``` export const users = pgTable('users', { id: uuid('id').defaultRandom().primaryKey(),...

D1 Blobs as ArrayBuffer?

Hey folks, I'm trying to store ArrayBuffers in D1 as Blobs. This Cloudflare page seems to indicate that D1 will automatically do the marshalling of blobs <> ArrayBuffers https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#type-conversion But I am just getting plain number arrays back unless I use a custom type: ...

Typing for checking column is foreign-key or not

Hi, is there any way to check if the column is foreign-key or not which return true or false by using typing. Check the example of primary-key attachment
No description

Help Needed with Drizzlekit Migration Issue

I've encountered an issue where I manually deleted a table in Drizzlekit Studio using DROP TABLE "orderProduct". This was due to a bug inside my orderProduct where I had both an "orders" and "order" column, each referencing the "orders" table, and I couldn't remove them. I'm not fully understanding how migrations work in Drizzlekit, which is why I'm reaching out. When I run bunx drizzle-kit generate and migrate, the table isn't being regenerated along with its relations. Bunx drizzle-kit generate output: `14 tables...

Prisma to Drizzle speak conversation help

I'm following this tutorial: https://youtu.be/ZK-w-yFWfxM?si=vzCR10TQuSonafBs "Add Clerk Authentication & Stripe Payments to your NextJS tRPC Application" I need help converting this switch function written in Prisma-speak to Drizzle-speak. TIA!...
No description

getting DROP SEQUENCE prompt while doing db push

after i took the update I'm getting DROP SEQUENCE prompt while doin db push and its failing even if there is no changes in the table , my table is this : `import { pgTable, serial, text, timestamp, integer, real, json, boolean } from "drizzle-orm/pg-core"; export const branchLocationTable = pgTable("branchLocation", {...

What is the __old_push xxx

Hello im curious, sometimes when i try to do a drizzle push after generating and migrating my database, i get this error SQLite error: no such table: main.__old_push_songs What is the reason i get this error?...

Weird numbers in terminal 💀

After the config and defining schema, I ran
npx drizzle-kit generate
npx drizzle-kit generate
and some weird text with numbers came up. It did create migrations folder with sql though. ``` PS D:\Typescript\drizzle orm\drizzle_test> npx drizzle-kit generate No config path provided, using default 'drizzle.config.ts'...

Not type-safe [x:string]: any

Hello, I have created some Drizzle schemas and want to get some data. Pretty normal it seems like. However, sometimes/somehow, the type safety just dissapears. How can I fix this?...
No description

Keyboard input not working when `table created or renamed from another column?`

I'm using drizzle-kit with Bun. Not able to select with arrow keys or type anything when prompt asked.
No description

can we have production migrations recommendations docs for drizzle?

Right now, when using migrations, frequent errors occur when data exists for a column and then there is an alter command for that column. Worse is when those migrations happened in a different file, and the other migrations are applied, we cannot rollback, causing the site to not run properly. That's the state where we'll have to manually fix issues.
No description

Help! Can't install drizzle-orm

I am absolutely new to drizzle and just prepared a fresh new nextjs project to try it out. Right after my nextjs setup, I tried to install drizzle with mysql2.
npm i drizzle-orm mysql2
npm i drizzle-orm mysql2
Then got this massive error that says -...

UnsupportedResultException: The result contains the unsupported data type regclass

getting this error when i try to run drizzle-kit push I am using sst ion to deploy my rds instance. drizzle-kit version: 0.24.0...

Latest update has broken studio

Hi! Today after updating to the latest version, my studio launches but I cannot access it anymore. Here is the stack trace ```TypeError: Cannot read properties of undefined (reading 'tables') at https://local.drizzle.studio/index.js:12873:27177 at Array.forEach (<anonymous>)...

Error using drizzle-kit studio

I started encountering this issue out of the blue today without having changed any bit of the code (As far as I remember) Error: The result contains the unsupported data type "CHAR". There seems to be an open bug https://github.com/drizzle-team/drizzle-kit-mirror/issues/542....

snapshot.json is not of the latest version

Hi! I just updated drizzle ORM in my project to:
"drizzle-orm": "0.33.0", // from "0.30.9"
"drizzle-kit": "0.24.0", // from "0.20.17"
"drizzle-orm": "0.33.0", // from "0.30.9"
"drizzle-kit": "0.24.0", // from "0.20.17"
...

Functional Indexes

So working with PlanetScale and have a query that checks for LOWER(city) and LOWER(state) to handle user input. How can I use Drizzle-orm to create the composite functional index. I've tried a bunch of variations like the below but no luck. stateCityIdx: index("state_city_idx").on( sql(LOWER(${table.city}) LOWER(${table.state})), ),...

MYSQL iterator() streaming hangs randomly

https://orm.drizzle.team/docs/select#iterator I am trying to stream results using the iterator feature. But the iteration seems to hang randomly after some time. Any idea what could be leading to this or if it can be a bug? ```ts const iterator = await db.select().from(users).iterator();...

Are (async) transactions supposed to work in expo-sqlite?

I'm using drizzle with expo-sqlite in an expo/react-native project. The database works as expected except for transactions. As shown below, when an error happens inside a transaction the transaction is not rolled back and the error is not caught in any way. With manual tx.rollback(), I get [DrizzleError: Rollback] as expected, but it also is not caught and no rollback happens. Am I doing something wrong or are transactions even supposed to work in expo-sqlite? I couldn't find anything explicit in the docs about this. There's also this open issue (https://github.com/drizzle-team/drizzle-orm/issues/1723) where expo-sqlite was also mentioned at some point. ...