Drizzle Team

DT

Drizzle Team

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

Join

Where based on relationships?

I'm trying to query the database for a specific values which fit a filter based on relationships. Is this possible? ```ts const result = yield* Effect.tryPromise( () => db.query.productUniqueId.findMany(...

I am getting an error when I defined the db

I have downloaded the necessary package using the bun but still it's throwing an error.
No description

Pgschema

Hi all, can anyone guide me on the correct syntax for querying from a table with a table schema? Everything in public works fine with like db.query.publictable.findmany but as soon as I have a table with a custom db schema like myschema.table and I’ve added it to db I can’t query with db.query.myschema.table.findmany

Custom column type

is this posible?
const intZeroNotNull = integer().default(0).notNull()
const intZeroNotNull = integer().default(0).notNull()
and how i should make it work, because this doesn't...

I deleted table generate went well but on migration it makes error that table doesnt exist

I deleted one table called stripe_keys i made drizzle-kit-generate went well not errors but after migrating i get error that table does not exist what should I do?

bug when using push for sqlite indrizzle kit on latest

TypeError: This statement does not return data. Use run() instead ``` npx drizzle-kit push No config path provided, using default 'drizzle.config.ts'...

DrizzleZod - Can't use "createSelectSchema"

Hi! I have an issue with drizzle-orm & drizzle-zod from the beginning of my turborepo project. Packages: ``` ...
No description

Marking a Query relation as `required`?

I currently have a query like: ``` const friendTransactions = await db.query.transactions.findMany({ with: { splits: {...

Type Error when inserting into table

I'm getting as error when trying to insert into a table using: ``` await db.insert(users).values({ id: userId,...

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: ```...