Drizzle Team

DT

Drizzle Team

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

Join

Why Isn't RLS Working with Drizzle and Supabase?

Hi everyone, When I enable the new RLS (Row-Level Security) feature on Drizzle and Supabase and migrate, I can see it applied, but it doesn't seem to work as expected. Unfortunately, all data is still accessible, even though the default behavior should block access if no policies are defined. Do I need to write some specific queries with Drizzle for RLS to function properly?...
No description

Unable to create a check constraint for NaN values

I am working to prevent any chance of NaN from being inserted into my DB, so I created a check constraint that looks like the following: (table) => [ check("fancy_check_name", sql${table.amount} <> NaN),...

How to fix collision / race condition

Hey there. I am working on a project with another team member. We are using Drizzle ORM. I merged the code of my team mate to my branch and when I trying to generate a new migration, I am getting this error:...

Passing transaction to functions

Hey everyone. Quite new to the drizzle sphere. Coming from Go, i am quite used to passing db transactions from function to function, to be able to orchestrate a bigger function from smaller ones. As an example, say i have some music track. each track can have multiple genres, and each genre could be associated with different tracks - a many-to-many relationship. Essentially, i would love to be able to create this chain of functions:...

Switched to Neon Websockets but now some queries are timing out

Hi everyone, I was using transactions for a specific query (needed all of them to cancel if one failed for a form builder). So I followed this tutorial to switch from Neon HTTP to Neon Websockets: https://orm.drizzle.team/docs/connect-neon But now I'm seeing that other queries are extremely slow & some are even failing (see attached screenshot)...
No description

Drizzle Kit

Im using neon driver and i'm getting some wierd errors when migrating or pushing changes

TSC build error

When i try to build my package with tsc, I get 71 errors, all of which look like this:
../../../node_modules/drizzle-orm/sqlite-core/utils.d.cts:25:56 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.ts")' call instead.

25 query: TExisting extends true ? undefined : import("../index.ts").SQL<unknown>;
../../../node_modules/drizzle-orm/sqlite-core/utils.d.cts:25:56 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.ts")' call instead.

25 query: TExisting extends true ? undefined : import("../index.ts").SQL<unknown>;
```Found 71 errors in 24 files....

There's no drizzle-orm/connect anymore?

I'm on the latest vestion and I'm seeing this. I thought it was release on 0.34?
No description

Greater than comparisons with timestamp mode string

I'm getting type errors with the gte comparison operator on a timestamp column that has a mode of string. The mode should only affect the output data type of queries, not the type in the DB right?

Custom migration

I have a user table where the userId (FK) is a serial and I want to convert it to uuid. There is already data in that table. How can i do this custom migration? Do I need to create a custom migration file and write the DML?

drizzle-kit introspect schemaFilters parameter ignored

When I try to execute the following on the command line, always the "public" schema is used and not the "pgmq" schema. It's as though --schemaFilters is being ignored. Am I doing something wrong? ``` npx drizzle-kit introspect --url="postgresql://postgres:[email protected]:54322/postgres" --dialect=postgresql --schemaFilters pgmq --out test Pulling from ['public'] list of schemas...

Unable to sort relational query

The docs says this should work: ``` await db.query.posts.findMany({ orderBy: (posts, { asc }) => [asc(posts.id)],...

The tablesFilter option doesn't work

No matter what I try I cannot get the tablesFilter option to work. It always migrates all tables regardless of if I am using push or generate package.json `{...

Why does drizzle want to request the same column twice from db?

So basically this is my function: ``` async getUserByToken({ token }: { token: string }) { const sq = this.db .select()...

Error with tipe in InferInsertModel

Hello! I have a table visit with an optional field comment (it is not marked as notNull). However, when I use InferInsertModel to type the data for insertion, the comment field is not included.
No description

Has anyone gotten Tauri v2.0 sqlx to work with drizzle?

Hi, I'm wondering if there is a way to make drizzle work with Tauri's SQLite driver? It would be nice to have simple type safety when working with the SQLite DB in the Tauri frontend. Does anyone know if it's possible to make this work? https://tauri.app/plugin/sql/...

0.36.0 - The third parameter in Drizzle ORM becomes an array

Hello guys, I'm trying to setup Auth.js with Neon Postgres + Drizzle Adapter. The example given at think link: https://github.com/drizzle-team/drizzle-orm/releases/tag/0.36.0 for third param becomes an array is too basic for me to understand how do I change Auth.js schemas for accounts and sessions table to work with new version of Drizzle. I'd very much appreciate if someone can change the following schema from object to array for third param i.e. setting up a compound primary key. Thank you. export const accounts = pgTable(...

Read Replica Health Check

Is there a way to health check read replica or not needed because it switches to primary? also is there a better way to check if connection is working properly? at the moment I query a table. ```ts...

Hi, can I ask if anyone got CORS issue when running drizzle studio on windows with seveltkit?

Hi, can I ask if anyone got CORS issue when running drizzle studio on windows with seveltkit?

Read Replica Type Annotation

How do I properly type the read replica global variable.
No description