Drizzle Team

DT

Drizzle Team

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

Join

how to make a session using drizzle

```ts import express from 'express'; import session from 'express-session'; import genFunc from 'connect-pg-simple'; ...

Aws Rds with drizzle

My Schema on Aws Rds is not updating , once i update my schema and generate the schema , i am not getting any errors but still the migrations seems to fail , when i try to insert into that table BadRequestException: ERROR: relation "fuc" does not exist Position: 13; SQLState: 42P01 I get this...

Error: Can't find meta/_journal.json file when trying to apply migrations in a lambda

I'm trying to apply migration in a lambda locally with running sls invoke local -f db_run_migrations I use serverless framework with the serverless-esbuild plugin to package my lambdas I execute the lambda using the sls invoke local -f db_run_migrationscommand This is my folder structure and lambda handler...

Nested joins / where on relation

Hey guys! I have a question regarding filtering a query. Basically, I need to filter the query by order relation - order.date is the field I want to filter by. However, I've noticed that filtering by relations is not yet supported. How do I write the query with joins? I can't figure out how to created nested joins (subOrders -> order and subOrders -> product -> kitchens -> kitchen etc.) This is my query: ```ts const suborders = await db.query.subOrders.findMany({...

Relational queries with planetscale - findMany etc undefined

Hey there! I am trying setup drizzle orm with relational queries with planetscale, but not sure how to debug this. I am following the docs on the setup for this, but after the setup it seems to not find the correct APIs. svelte kit ...

how to use serial within compound primary key

```ts export const refund = pgTable("refund", { id: serial("id").primaryKey(), purchase_id: integer("purchase_id") .references(() => purchase.id)...

Multiple relations

Let's say I have this relationship from message to users: ```ts export const MessageRelations = relations(MessageTable, ({ one }) => ({ sender: one(UserTable, { fields: [MessageTable.sender_id],...

When using with in relational queries the `orderBy` function is not typed.

I'm trying to query with relational queries and I've made sure to define the relations correctly. The types work for when I'm selecting columns. I also can't see the where to filter the table....

Syntax Error and missing fields when pulling schema.

I already have a project in which I used prisma. Now I want to switch to drizzle, I ran drizzle-kit introspect:pg and it generated a schema.ts file as expected but the user model is missing role field and schema file has Syntax Error

Support for streaming rows?

Is there planned support or at least would it be considered to support streaming large result sets in Drizzle? Both postgres and mysql drivers support streaming rows and expose it as an async iterator. It would be great if this was supported natively in Drizzle...

Planetscale Serverless for Relational queries

Currently it is only supported to use mysql2 for using the Relational queries feature with Planetscale, with that the advantage of using the serverless driver with planetscale vanishes. Would it be possible to implement the planetscale serverless driver instead of mysql2? Thanks for any answer 🙂 Edit: Yes you can use it with PlanetScale driverless just like normel...

Is it safe to use: `sslmode=require`?

I keep getting: error: connection is insecure (try using sslmode=require`) - Can I safely use in localhost & production?

Error with drizzle-kit generate:pg

Transforming const to the configured target environment ("es5") is not supported yet

Recommended approach for generated columns

since generated columns aren't supported yet in Drizzle, i wanted to know what's the recommended approach to declaring one (in PG)

Which driver should I use for neon?

Currently I use neon and all seems to work fine, also db:push with the driver set as pg. The only issue I have is with studio which throws: ```sh Cannot find package 'pg' imported from ...node_modules/drizzle-orm/node-postgres/index.mjs...

Top Level await issue with latest [email protected], mysql2, planetscale

We are getting this error when following the release notes recommended setup for pscale/mysql: ``` [ERROR] Top-level await is not available in the configured target environment ("node14") remix-app:dev: remix-app:dev: ../../packages/db/index.ts:18:19:...

Nullable relational query?

In the following, shouldn't res.jobSeekerProfile possibly be null? Basically what I want is to get the user - Include their jobSeekerProfile (if they have one). Currently, it seems to assume that jobSeekerProfile always exists for the user ```ts let test = db.query.users.findFirst({ where: (users, { eq }) => eq(users.id, '1'), with: {...

customType causing type error when performing operation on table

I have a simple customType to use the citext extension in Postgres. ```ts import { customType } from "drizzle-orm/pg-core"; ...

How to specify type using sql template

I'm using this piece of code ``ts const ids = [ 3445, 3446, 999 ]; const values = sql.join( ids.map( v => sql(${v}) ), sql,` );...

Why {unique:true} doesn't throw?

If I add 3 users with the same email address, it adds them without any issue. How can I make sure the email is unique? I also tried with: email: varchar('email', { length: 256, unique: true, notNull: true }).primaryKey() ...