Drizzle Team

DT

Drizzle Team

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

Join

Authentication error running studio on remote D1 instance

Error Id: 49d50103a03c4a8d9520a475dde81e44 Drizzle Config ```...
No description

BEGIN ... COMMIT inserted wrong

I'm trying to run this code: ``` await (db).transaction(async (tx: any) => { for (let i = 21; i <= 25; i++) {...

Issue with types

I'm getting a typeerror here that looks like this. When i use @ts-ignore the code runs and executes as intended with the proper database output.
I tried troubleshooting by making sure all my drizzle packages are on the same version (they are). I don't want to litter my codebase with @ts-ignore, so is there a way around this? Project setup...
No description

isNotNull TypeScript automatic type Narrowing

Hey guys! I'm having some trouble with the typing of my DB. ```ts const reservations = await db .select({...

How to support multiple providers?

Is it possible to have an app using drizzle default to PGLite for frictionless auth less startup for someone checking out the app’s codebase. But allow a deployed prod instance to use Neon Postgres?...

What is the best way to handle Query Errors?

Hello, everyone! I'm testing Drizzle right now and i'm a little confused about what is the best way to handle erros in Drizzle. I have a POST method that creates a user and the e-mail is unique. When the e-mail is already in use and Drizzle throws a error, the error type is DrizzleQueryError, imported from "drizzle-kit/erros", but it seems broken, i dont have the right type for the error code. Thanks in advance!...
No description

$returningId() can not read properties of undefined id

Hey everyone! 👋 I’m running into an issue with onDuplicateKeyUpdate and $returningId(). I keep getting an error: “Cannot read properties of undefined (reading ‘id’)” I use drizzle with mysql (Planetscale)...

Typed results from QueryBuilder

Is there a way to infer result type from executing a query built with QueryBuilder? ```ts export interface NeedsToBeManuallyTyped extends Record<string, unknown> { customerId: number;...

Polymorphic Association

This is my current schema, coming from kysely, i thought drizzle had a way of putting a condition on the relation, is it not possible? ```ts export const products = pgTable('products', { id: serial().primaryKey(), name: text().notNull(),...

drizzle-seed breaks when trying to follow the one-to-one example

I am attempting to follow along with the One-to-one relation guide ( https://orm.drizzle.team/docs/relations#one-to-one ) The only difference is that I am using mysql (actually mariaDB) Here's my schema: ```typescript...
No description

drizzle-kit studio

i'm trying to access the drizzle studio using localhost like it says in the docs using npx drizzle-kit studio --port 3001 --host 0.0.0.0 when i hit localhost:3001 it return not found error...

View to compose two fields?

Hello I have three columns in my auth table today, name, givenName, and familyName. I was looking to get rid of the name one, and have a "view" that creates the name based on the other two. I looked at the docs but I can't really figure it out: https://orm.drizzle.team/docs/views...

Best approach for multi-tenant system with Drizzle?

I would like to create a multi-tenant system with svelte-kit using Drizzle ORM. What's the best approach to handle the database connection and always ensure tenant-id of user is used for all select, update, delete, etc? Would it make sense to create the Drizzle database object in hooks.server.ts (which is executed for each incoming request), validate the user, then create a kind of wrapper around the database object with the user-id and tenant-id, then pass the new object to the router and pages fro processing? Totally new to drizzle. What's best practice? Any tutorials around for this use-case?...

How much disruption can we expect in V1.0?

Hello there! I wrote a github issue few days ago asking about Drizzle sustainability long term, and Andrii mentioned that they were focused on v1.0 which was gonna be a mayor upgrade. I was wondering, how much disruption can we expect? I mean, if we embrace Drizzle now (coming from Prisma), are we gonna be going through another migration process in a few month with v1.0 is released or it will be backwards compatible?...

Migrate SQL Durable Object

Hey, I've been trying to run some migrations inside a Durable Object SQL storage, but for some reason the changes are never applied. I followed every steps in this guide, the migration only adds a new column to a table, nothing crazy. I also tried to delete the __drizzle_migrations table to somehow clean the migration history, but even that table is non-existent. Does anyone have an idea? Thanks in advance. "drizzle-orm": "^0.44.2" "wrangler": "^4.14.4" "drizzle-kit": "^0.31.1"...

Help with relational queries

hey yall! im trying to setup relational queries but im getting this error: any idea why? im exporting all members as its said in docs
No description

rqb v2: `with` is always nullable

I'm trying to migrate to rqb v2, but it seems that related tables in with are always nullable. Here's my query: ```ts const organizations = await db.query.organization.findMany({...

push don't add supabase policies, and if I use migrate postgresql complains auth.users exists

Hi, I'm stuck with this problem: I'm developing a muli-tennant webapp so I enabled RLS and defined policies so each tennant can only access to his data. However, it seems drizzle-kit push doesn't apply policies to supabase (I can't see any of them in the admin panel) , searching on github seems this is a bug, so I try to generate and migrate but then I face a postgresql error telling me that users table (from auth) already exists. So far I tried: moving the authusers table to another ts file (wrong, drizzle checks the dependency), editing the drizzle.config so schemaFilter: ['public'], doesn't solve the issue. Downgraded to ^0.30.0 and tried to push, same issue. ...

No matching version found for drizzle-orm@cache

```sh [00:~/some-path]$ pnpm add drizzle-orm@cache (0xtz52/0xd-13-improvments-000001✱)  ERR_PNPM_NO_MATCHING_VERSION  No matching version found for drizzle-orm@cache This error happened while installing a direct dependency of /home/tz/0xtz/edva-sms...

drizzle-orm/aws-data-api/pg typing problem

I encountered type error when accessing to tables which are defined in schema.ts. The schema is passed to drizzle client. Same codes work in node-postgres. Is this bug? or unsupported feature?...
No description