Drizzle Team

DT

Drizzle Team

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

Join

error with ILIKE on libsql

I'm trying to use ILIKE clause on libsql and I receive a error. Repository to reproduce the error: https://github.com/emersonlaurentino/libsql-ilike-error...

Dynamic query building

I'm trying to replicate the documentation and create a withPagination function using query building, but the types are causing an error. https://orm.drizzle.team/docs/dynamic-query-building...
No description

Another SSL error on import

I have an existing database and I wanted to try drizzle on it. Database is from a lesser known provider and is impossible to find reliable help to access it, but unfortunately I cannot change it. I want to use drizzle-kit introspect:pg here is my drizzle.config.ts...

Confusing error with neon

Hi all! Just setup a project with drizzle (via create-t3-app) but I get this odd, vague error when I try to push my schema to my neon db. Any ideas on how to even begin debugging this? ```$ dotenv drizzle-kit push:pg drizzle-kit: v0.19.13 drizzle-orm: v0.28.6 ...

Generate Random UUID Sqlite

Hey i was wondering how i would create a unique ID that contains a random string of characters for a text?
model User {
id String @id @default(uuid())
}
model User {
id String @id @default(uuid())
}
Something like this but instead of mysql and primsa. Have Sqlite and Drizzle...

Logging query time

Is it possible to log query time? I see that the current logger implementation sends the sql and the params of sql but I couldn't find anything which lets me see the time it took to run the query

[How To?] Generate uuids properly on cloudflare d1 sqlite...

I am running an app with Drizzle, TRPC, and Cloudflare D1 sqlite database: My initial project databasse schema looks like: ``` export const CarTable = sqliteTable('Car', {...

Dropping primary keys every time

so latest drizzle-kit fixed a bunch of issues with dropping indexes and preserving pk order but it's still dropping and recreating PKs every time `` ALTER TABLE account` DROP PRIMARY KEY;...

need help abstracting a function

This may be an easy answer but how can I implement the following type? ```typescript export const getUserWithEmail = (email: string, withConfig: any) => { return db.query.usersTable.findFirst({...

Does drizzle support `disconnect` relations ?

Does drizzle support disconnect feature on relations during update query similar to prisma ?

binary columns in drizzle studio

I have implemented the following custom type for storing blockchain addresses: ```typescript const address = customType<{ data: string; driverData: Buffer }>({ dataType: () => 'BINARY(20)', fromDriver(value) {...
No description

Access values in "where" query

Hey, so I wan't to do some calculations, specifically geo radius. How can I access the data while doing the query? ```ts const res = await db.query.apartments.findMany({ where: (apartment, { lte }) => { const long = apartment.long...

Unable to delete from many to many relationship due to FK constraint

I have the following schema, Users <> Teams - many to many usersOnTeams - table to hold this relationship ...

PostgresError: Relation X does not exist - After reorganizing schema

Hi guys, I have two tables (team and team_members) , which have a relation. All my schema was in one file and I decided to split it into multiple to make it cleaner. ...

how to do the opposite of inArray()?

i'm getting all collections (music single, ep, or album) that contain a certain tag. currently i'm doing this:```js const chosenTagCollectionIDs = tagMap.get(tag); const collections = await getCollections({ where: inArray(collectionsTable.id, chosenTagCollectionIDs),...

How to use drizzle-zod generated schemas in Next.JS frontend?

I'm currently using the pages dir in Next.JS and I have a function making an API call. I want to pass the returned body into the generated zod schema using zod and drizzle-zod. The problem is, when I import any created schema, I receive this error: ``` тип ../../node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:1:0 Module not found: Can't resolve 'net'...

TypeError: client.unsafe is not a function with neon

i get this error only when using the neon driver. with normal postgres, it works normally.

Getting "never" type from querying a relation

When I use query function with "with" on a one to many relation it returns the type "never". What am I doing wrong?
No description

mapWith, any special things to make it work ?

I can't seem to have mapWith() work - I am logging inside the function and it nvever gets called. I am doing some sql-fu and want to return a collection that is declared in drizzle, and would like to have it mapped to my js object. I tryed on sql``.mapWith(), sql.join().mapWith() without any success....

Why truncate??

Updating some schemas. All 48 records in the item table have cmsSlug and cmsId. All 48 records have a 36 character cmsId. So my question is, why are the only options to truncate or cancel? Output:...