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: prepared statement "s9656" does not exist

Not sure why I'm getting this because I have no prepared statement. I thought it might have been a bug with relational queries so I tried a regular select too. Both of these result in the same error. ```...
No description

PostgresError: unrecognized configuration parameter "schema" when creating client for postgres-js

Getting the error when I add schema to the call drizzle(client, {schema}) using version "drizzle-orm": "^0.28.5", "postgres": "^3.3.5", Error goes away when schema is removed. ...

Does throwing a regular javascript error inside a transaction, roll back automatically?

Curious if I need to actually call tx.rollback()? Or if we reach a regular error, or lets say a Postgres error occurs at some step, will everything be automatically rolled back? Or do we have to always try catch and rollback in the catch/finally block?...

Drizzle join in a subquery results in ambiguous columns

This fails with id ambiguous error, since the orderedQuestions.survey_question.id reference in the field selection of the second query generates the sql as 'id' rather than 'survey_question'.'id' as it should. ```ts const orderedQuestions = tx .select()...

Schema Definition Performance / Best Practice

Is it considered bad practice to have one massive client / schema definition for my whole project that is imported everywhere, or should I be creating a client with small smaller sub-schemas for each module? are there any significiant performance benefits to the latter? My project has about 20 tables with relations and am running into performance problems in my development environment (nextjs takes a long time to build routes in dev mode). Is splitting out multiple smaller schemas something that is likely to help much?...

Is there a recommended way to find or create a record? (postgres)

I don't want to do an insert with ON CONFLICT RETURNING since I have triggers which fire on row update and can't have them be called without an actual row change.

Get plain typescript type from enum

Hi, I am working on a NestJS + Drizzle app and I have the following in my schema:
export const userPermissionLevel = pgEnum("permissionLevel", ["admin","moderator","user","banned"]);
export const userPermissionLevel = pgEnum("permissionLevel", ["admin","moderator","user","banned"]);
...

Can't build app due to missing dependencies with Drizzle

Hello y'all, very new to drizzle and while trying to use the quick start guide I ran into the errors pictured. I am running a Nodejs server compiling JS to TS, with Express. Currently all i have in the file is the basic express example and the basic Drizzle example yet I cannot compile. Any help is appreciated. I already made sure I had all required libraries as per the quick start guide. Thank you....
No description

Why does JSON configuration for drizzle-kit not require a dbCredentials?

Hello, according to https://orm.drizzle.team/kit-docs/overview#configuration. For both JS & TS of the configuration we are allowed to pass in a dbCredentials ``` export default { schema: "./schema.ts",...

What's the correct type to use for an update function?

I'm trying to do a simple function where I update a record in a table: ```ts import { NewVideo, VideoTable } from '~/db/schema/video'; ...

Studio with AWS Data API?

Is it possible to use Drizzle Studio with the AWS Data API, seeing as it doesn't have a true connection string (from what I understand).

Deferrable foreign key constraints

Hi, does anyone know a way to declare deferrable foreign key constraints when defining a Postgres table using pgTable, and a way to issue SET CONSTRAINTS within a transaction when querying in Drizzle? Thanks! https://www.postgresql.org/docs/current/sql-set-constraints.html...

Turso with Cloudflare Pages

I would like to use Drizzle, Turso and Cloudflare Pages but Drizzle does not support @libsql/client/web is there any way to do it ? Thanks you. https://docs.turso.tech/reference/client-access/javascript-typescript-sdk...

In memory tests with libsql?

Do you guys know if there's a way to get this working with libsql? I'm using turso, and was hoping to get the DB working in memory for local tests. I have this...

Help with types in Repository Pattern

Hello, I'm trying to set up a crud repository where it can be extended but I'm not sure how to get the typings correct. Here is what I have and I'm stuck. The issue that I have is I'm not sure how to actually get the primaryKey in a type safe way....

what do we need to pass in --ssl to enforce SSL?

I have a Supabase database where SSL has been enforce. But Drizzle fails to connect to DB giving local SSL certificate error. It works fine once I disable enforcement on Supabase side. I see there is a --ssl parameter in command line, but it does not do anything/I am missing something. Can anybody please help here?

Transforming SELECT from case to camelCase via sql with execute

I am getting some values for example
comments.created_at,
comments.created_at,
I wish to transform this with the AS keyword:...

How drizzle handle nulls and undefineds ?

I'm running this query, but some values in where clause are undefined, how do i make it optional ? Error: UNDEFINED_VALUE: Undefined values are not allowed query:...

Relational queries result types are not working

Hi, When i call findMany or findFirst with no args, the result type is ``` const trips: {...

defaultRandom() on uuid results in an error

id: uuid('id').unique().primaryKey().notNull().defaultRandom(),
id: uuid('id').unique().primaryKey().notNull().defaultRandom(),
upon insert, this results in the error: NeonDbError: db error: ERROR: invalid input syntax for type uuid: "ia4afwolcuk4rks"...