Drizzle Team

DT

Drizzle Team

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

Join

Using the drizzle-graphql with custom defined types.

I'm trying to use drizzle-graphql but, it's breaking with this error:
Error: Drizzle-GraphQL Error: Type custom is not implemented!
Error: Drizzle-GraphQL Error: Type custom is not implemented!
I have a couple of custom column types like timerange but, it seems like it's breaking the library....

Struggling to build common pattern with queries -- fetching with count + offset/limit pagination

Hi team! Love what you all are doing with Drizzle. I have an extremely common pattern that I use in my application which is using Drizzle queries to create paginated results like so: ```ts export const getFullSlots = async (options: GetFullSlotsOptions) => {...

DrizzleKit check constraint generation missing value

I added a constraint to this table: ```TypeScript export const purchaseOrderLineItem = createTable( "purchase_order_line_item", {...

Drizzle folder schema

Sure u can do this but can't find it in the docs, how can i pass schema within a folder to a db instance so it has all of the types. Something like this? I'm sure there must be a way to do this without importing each individual file. Thanks! (schema path is right just can't import as its a folder not a file)
No description

Problem with findMany with many-to-many relations

First, here's my schema file: ` import { integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core' import { relations } from 'drizzle-orm'...

Conditional NotNull Column?

I have a 'users' table. User can have both phone number or email, or either, but both fields can't be null. I tried adding the following constraint to my table: sql "CHECK (email IS NOT NULL OR phone_number IS NOT NULL)" But running into this issue on insert:...

Trouble with nested queries and ambiguous types.

Is there an easy programatic way to give aliases to selected field? I have a problem where if I want to join on a subquery I get ambiguous ID and I have been banging my head against this for hours. TYIA

Rollup failed to resolve import vite-plugin-node-polyfills/shims/buffer from drizzle-orm/sqlite-core

I just started getting this error: drizzle-orgm: 0.35.2 vite-plugin-node-polyfills: 0.22.0 ...

Using UUID v7 with Drizzle?

Can I use UUID V7 or some other sortable ID primary column that is not a easy number?

Drizzle Studio fails to run due to TypeError

pnpm drizzle-kit studio, won't launch Studio. It was working fine, but I added a few new tables and relations to my schema and it won't launch. The strangest part is generate and migrate run without errors. Here is the error output: ```...

Querying groups where a given user id is a member

The ideal SQL I'm trying to replicate is the following: ```sql SELECT groups.id, groups.type,...

Module "drizzle-orm/node-postgres" has no exported member 'migrate'

Hi, I'm trying to setup basic app with drizzle for the first time and im following option 4 instructions (generating sql migrations and applying at runtime) link: https://orm.drizzle.team/docs/migrations and I'm unable to import the migrate function. Any clues? Versions: ```json {...

SQL_NO_STATEMENT

cant make my migration migrate to turso, brings up this error: ResponseError: SQL string does not contain any statement...

could not determine data type of parameter $2

export function duration(duration: string) {
return sql`now() + interval '${duration}'`;
}
export function duration(duration: string) {
return sql`now() + interval '${duration}'`;
}
...

sql operator automatically inserts wrong json quotes around expression

const sqlString = sql`select * from ${workflows} w where JSON_CONTAINS(w.definition, '{ "data": { "formId": "${formId}", "type": "form_submission" }}', '$.nodes')`;
const sqlString = sql`select * from ${workflows} w where JSON_CONTAINS(w.definition, '{ "data": { "formId": "${formId}", "type": "form_submission" }}', '$.nodes')`;
With this I get the following error ```bash...

`pageId` does not exist when inserting, even though it's in the schema

I have the following schema: ``` export const scrapeStatusEnum = pgEnum("scrape_status", [ "error", "not-enough-information",...

Is there a way to create this query in drizzle?

Hi, I have this query for my mobile app with expo and react native. I need to have a recursive query, but cant seem to find how to create one in drizzle. ```sql WITH RECURSIVE LabelHierarchy AS ( SELECT id, name, parent_id FROM labels...

Error while providing Schema to drizzle client.

Getting error while providing schema to drizzle client. Here are my files, do let me know what am I doing wrong. ``` Type 'typeof import("d:/workspace/template/src/database/schema/index")' is not assignable to type 'Record<string, never>'. Property 'users' is incompatible with index signature....
No description

“If does not exist” for migration schemes and add a column to an existing table

Hello, I'm new to Drizzle, and for a project with postgres and NextJS, I'd like, during a migration, to specify that schemas must not be recreated. db/schemas.ts: ...