Drizzle Team

DT

Drizzle Team

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

Join

Postgres + WITH sql

I'm trying to do the following sql: ```sql WITH v (id) AS ( VALUES('448e2cc0-aa49-4339-babc-db8aec706ea6'), ('b7709b0a-5c38-436a-bad9-a7330890d7db'),...

sqlite http-proxy can't handle undefined values on `.get()` ?

Hi drizzle team! I've been playing with the http-proxy plugin to see how it works, and I hit a funny edge case trying to handle undefined values on get(). The docs show this barebones example to set up an http proxy: ```ts const db = drizzle(async (sql, params, method) => { try {...

Build fails because of drizzle typescript files

Created a node drizzle backend with typescript. When i run TSC for my build to compile Any idea whats up? Im on the latest versions ...

Invalid config file when doing any command with drizzle-kit

This is my config file: This is my terminal output when I try to push to the db (hosted on planetscale): Any help with this would be greatly appreciated. Please do ask for any additional info if needed....

Is there any tip for unit testing with drizzle?

I'm trying to write unit test code with drizzle, but I have no idea how to write create statement with rollback. - Using transaction for rollback could be a way, but I think it's too complicated for testing. - Drizzle instance is too complicated to mock. - I also have thought about creating repository class, but I don't think repository can handle complicated query (like query with join). ...

How to do this in drizzle schema?

I moved from PrismaORM convert this model schema to drizzleSchema (nested self) How to do that? ```yml model Category {...

introspect failing with pscale db

Getting a strange error when running the introspect command. I'm using a connectionString from pscale. drizzle.config: ``` schema: "./schema.ts", out: "./drizzle",...

Error

Hi, I'm getting the following build error (see attached file), any help would be appreciated. Using node v18 with Typescript.

Duplicate rows from distinct query

This query returns duplicate rows. Are there any things on the surface of this query that points to what the problem is? ```typescript export async function getAllDynamicPrompts(limit: number = 10) { const res = await db .selectDistinct()...

order by array_position does not order the records in postgres

Using array_positions either throws error or ignores the order If i try to do it this way i get an function array_position(record, character varying) does not exist error ``` const articleData = await db .select()...

Placeholder in updates

Hello, I just started using drizzle by doing a very simple todo app. I have some trouble understanding how to get dynamic values inside the object taken by the set function on update. ...

How do I define a composite foreign key?

Similar to this syntax in prisma?
%field% %Type% @relation(fields: [id, objectType], references: [objectId, objectType])
%field% %Type% @relation(fields: [id, objectType], references: [objectId, objectType])
...

getaddrinfo ENOTFOUND

I am getting this error when working with drizzle studio or just any regular drizzle connection. I am using planetscale and was able to do select commands from mysql2.js. But once I add drizzle nothing seems to work. Running in sveltekit and building to vercel. Any tips are appreciated! https://github.com/davidbrown010/support-dashboard

Cannot create custom `sql` query with casted array of uuid values in Postgres

A necessary use case is to search a column of Postgres type uuid[] by comparing against a dynamically provided array of values. Due to the way Drizzle escapes quotations in the parameter input, I am unable to get this to work with more than one value. I have tried using the Drizzle inArray() helper, supplying a custom sql query in db.execute(), supplying the sql in the db.select().from(tableSchema).when(), and using the PgDialect class to construct the query. If I write the query in my Postgres GUI, I am able to query successfully. The problem seems to be around providing Drizzle the dynamic array of values and the way it is constructed in the query. The Postgres query I need to construct:...

Order by multiple computed columns

Hey y'all I'm trying to accomplish a query similar this query using Postgres’ text similarity function. ```sql SELECT *, similarity( col1, ${val1 “”} ) as col1_sml, similarity( col2, ${val2 “”} ) as col2_sml FROM my_schema.my_view WHERE col1 % ${val1 “”} OR col2 % ${ val2 “”}...

Schema issues with split files, relational queries

I'm having issues getting db queries to work with split schema files. My config (drizzle.config.ts) looks like: ``` export default { out: './drizzle',...

Error when calling drizzle-kit push:pg again

When I call the command for the first time, everything is fine, everything is entered into the database, but if I call it the 2nd time. The following error appears: ```drizzle-kit: v0.19.9 drizzle-orm: v0.27.2 No config path provided, using default 'drizzle.config.ts'...

Insert multiple rows + onConflictDoUpdate

Is it possible to insert multiple rows (array) and at the same time using the onConflictDoUpdate? I'm trying it out but I get this error: ``` TypeError: Cannot read properties of undefined (reading 'name') at ghh5w224esf.js:70758:77...

Why does it take 3s for Login, LogOut

Github : https://github.com/SikandarJODD/sveltekit-drizzle-auth Hosted Link : https://sveltekit-drizzle-auth.vercel.app Point : i want to Create Auth using Lucia - Drizzle ORM - SvelteKit It works fine on Localhost , But it takes 3s for Login, LogOut ...

Error trying to create migration file

I added a new table to my schema.ts and tried running a migration and get the following error - I removed the new table definition from the schema file and it's still failing with the same error if I run the migration. I can't see anything obvious in the error to track it down to where in the scheme file it's unhappy. No config path provided, using default 'drizzle.config.ts'...