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 deal with .json().type<T> where T is an interface with a date

Is there any way to tell .json also deserialize the date as a date if the typescript interface has a property that is a date field? what's the recommended way to deal with this?

Drizzle not being able to push with bun:sqlite

I'm following the bun quickstart and did every step. The problem is that when I try to push content, it doesn't even try to use bun stuff, it seems to default to better-sqlite3or @libsql/client, which doesn't really make sense. If I already have a driver, I don't need another. I didn't seen anything specfic to bun, so was the bun:sqlite support just dropped?
No description

How to deal join field possibly null type? Typescript errors even after checks

Hi, I have an issue with left join return data. I am validating that it's not null, but still type check fail unless I do massive deconstruct. ...

push not detecting existing constraint and then failing with error

Hi! I just migrated to the latest versions of drizzle-orm (0.44.2) and drizzle-kit (0.31.1). I have a postgresql db. Most things with the migration seem to just work, I have a codebase-first approach and an existing drizzle folder with a history of snapshots. I swapped my commands to use drizzle-kit now, primarily drizzle-kit generate and drizzle-kit migrate. However, since my team has grown, I wanted to experiment with using drizzle-kit push to rapid prototype during development without actually generating files....

Cant use query with pglite + drizzle local

This is my current instance ```ts import { drizzle } from 'drizzle-orm/pglite' import { cachedCategories } from './schema' ...

drizzle.query doesn't work with tables outside `public` schema

I can't make the drizzle query syntax work with tables in my custom schema. Am I missing something? This is a reduced example of my setup: ``` // db/schema/index.ts const customSchema = pgSchema('custom')...

`Error [AssertionError]` when inserting `Buffer` in a `blob` column (SQLite)

I'm using SQLite / D1. I have a column hash: blob("hash", { mode: "buffer" }) Whenever I try to insert values like this: .values({ hash: Buffer.from(new Uint8Array([1, 2, 3])) } an error is thrown with cause: Error [AssertionError]: false == true I can insert Uint8Array or strings directly with no runtime errors, but with TypeScript errors. If i change the type (.$type<UInt8Array>) typing works, except when querying the returned value is of course not a Uint8Array but a Buffer behind the scenes....

Drizzle-zod insert schema list

Hi all, Using the examples from the docs ```...

Heavy snapshots

Hey everyone, I have a big monorepo with a lot of tables in my drizzle conf. The issue? The snapshot are really big (+17k lines per snapshot), the drizzle meta folder is starting to be really big. Do you have any idea on how I can resolve that? Ty...

drizzle select() -> Expected 0 arguments, but got 1

Hey, when I try to make a select statement, I get this error: Expected 0 arguments, but got 1.ts(2554) On runtime it works but it still shows this error. Is this a known problem? ```...

Drizzle not being able to push changes

I just added drizzle to the project, added some schemas and boom, I can't push anything to the database.
No description

Mocking drizzle

Hello I am having such a hard time to mock drizzle for some unit tests, are there any official guides out there that I can take a look at? I've tried ...

Multiple leftJoins always returns never[]

Hey, I found something interesting with drizzle's leftJoin typing. If I stack multiple leftJoins back-to-back, the result is always never[]. Is this intentional or a bug? ```ts import { pgSchema, primaryKey, text, uuid } from 'drizzle-orm/pg-core' import { drizzle } from 'drizzle-orm/postgres-js'...

select with sql<number> returns string

Hi everyone! I am new to drizzle and i have been trying to convert one of my sql queries to it ```sql SELECT ...

Depricated pgTable function

``` export const gp_data = pgTable( 'gp_data', { id: uuid('id').defaultRandom().primaryKey(),...

drizzle-kit push ignores SQL schema

I'm trying to create a Postgres schema using the method mentioned in https://orm.drizzle.team/docs/schemas, but when I run drizzle-kit push, nothing is added to the database. It works fine when I just use pgTable to declare the tables, and drizzle-kit generate creates the Postgres schemas as well. My current src/schemas/auth.ts file looks like this:...

[DRIZZLE KIT] Cannot convert undefined or null to object

``` [1] No config path provided, using default 'drizzle.config.ts' [1] Reading config file '/workspaces/drizzle.config.ts' [1] Cannot convert undefined or null to object [1] tsx node_modules/drizzle-kit/bin.cjs studio exited with code 1...

Authentication error running studio on remote D1 instance

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