Drizzle Team

DT

Drizzle Team

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

Join

dynamic relational queries column returns

Hi I'm not entirely sure if this is the intended result when trying to make a relational query. ```ts //type is derived from a mysql table type User = {...

Error updating a record

I'm getting an error typescript: Cannot find name 'buildings'. Did you mean 'buildingId'? [2552] when trying to update an item ```ts import * as schema from "@/drizzle/schema" import { PostgresJsDatabase, drizzle } from "drizzle-orm/postgres-js"...

using postgres-js for connection

I am trying to setup drizzle with postgres-js package ( as document it be fastest). Referring to this doc: https://orm.drizzle.team/docs/installation-and-db-connection/postgresql/postgresjs How do i define schema using postgres-js ?? I tried import for table to my schema file and typescript shows error: Module '"drizzle-orm/postgres-js"' has no exported member ... ...

How to check if is not null

Hello,
await db.query.users.findFirst({where: (users, { eq }) => eq(users.name, 'test')});
await db.query.users.findFirst({where: (users, { eq }) => eq(users.name, 'test')});
i want to find all users where name is not null. How to do in this situation?...

Using PgArray

Hello, How can I use postgres arrays in drizzle? I want to have one column to be a string array. Thanks!...

Timestamp as string

so when i have a timestamp in string mode, setting new Date().toISOString() does not work - i need to drop the trailing Z from it can drizzle handle this?...

db push when adding notNull column with default() value

I've added this column to my table: fullfilled: boolean("fullfilled").default(false).notNull(), But when running drizzle-kit push:mysql I get this: ``` ...

Set unique index length

I'm using a custom blob column type in mysql and need to specify a unique index on it. Because it's a blob the index length must be set but there seems to be no way of doing this? Anyone have some idea?

Trouble getting query to work with subquery

I'm having trouble getting this query to work in drizzle, ```sql SELECT i., h1. FROM items i...

Generic update component using table schema – how to type the table argument?

SOLVED IN BOTTOM COMMENT I'm attempting a generic update checkbox component where I can pass a type of MySQL (PlanetScale) table, and an associated keyName, and use those params in the db.update() query. Can anyone guide me on how to type the table argument?...

require() of ES Module not supported

This isn't too related to drizzle-ORM, but I figured I'd ask it here: I'm trying to connect drizzle to my PlanetScale database like so: ```...

Is it possible to tell drizzle which schema to use on the database?

I'm trying to introspect a postgres database with multiple schemas but I want only one of them. Currently drizzle is including only the public schema in the introspect which ends up not being what I want....

Has anyone done a custom `bytea` column type for postgres?

I'm trying to move our work project to drizzle and the first thing I encountered was the missing bytea column. There was an open issue for it in the github, so I was wondering if someone has already implemented bytea so that I can reuse it πŸ˜„...

What does this section of the docs mean?

Under the docs for indexes and constraints it says that drizzle kit only supports index name and on() param. What does this mean? Would the following not work with drizzle kit then? ```ts export const users = mysqlTable("users", { clerkID: varchar("clerk_id", {length: 255}).notNull().primaryKey(),...

Schema not added to FK constraints

Hi! πŸ‘‹πŸ½ I'm trying to use drizzle with MySQL. I have a mysqlSchema that I made and then am trying to create a FK but the generated SQL doesn't include the schema. ```ts...

Drizzle npm package not working

Hey guys, I have tried to create an npm package with my drizzle schema and types but when installing it and importing I keep getting this```ts Error: node_modules/drizzle-orm/db.d-a6fe1b19.d.ts:521:15 - error TS2515: Non-abstract class 'PgSelect<TTableName, TSelection, TSelectMode, TNullabilityMap>' does not implement inherited abstract member 'getSQL' from class 'PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>'. 521 declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> { ~~~~...

Do we have to add enums to the migration manually?

I have the following in the my schema: ``` const membershipRoleEnum = pgEnum('membership_role', [ 'GUEST',...

Getting Started With Drizzle And Had A Few Questions

Hi! I'm getting started with drizzle after having been a long time Prisma user. I had a few questions about Drizzle as I'm getting started: 1. Is there a "cuid()" type of functionality where instead of using a integer key I can use a CUID? 2. How can I set non-id fields to be unique (In prisma, this was doable with the @unique)? ...

What's the overhead (if any) of using the new relational api?

I love the new relational api but I am wondering about the performance overhead

Multi-File Schemas

I think I posted this (https://discord.com/channels/1043890932593987624/1056966312997429278/1117546028787306557) on the wrong channel. Please advise. Maybe Admin can move it?