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 define field w/ postgres IDENTITY?

I am trying Drizzle out for the first time. I thought to flex the quick start with realistic production user table schema. I can't find anywhere (including searching GitHub for examples) how to define the following field?? ```...

Check Constraint not working?

@Andrew Sherman fyi - this doesn't seem to generate the check constraint
No description

Is there a --force option for generating migrations in CI?

Hey guys, thanks for building this awesome tool. Our team loves it. We are using Github Actions and Drizzle to run migrations on a Postgres Docker Container during CI. However, we got stuck at the following: When running the generate-migrations command, it prompts the user (which does not exist in CI) to select whether to rename a column or create a new one. Since we cannot provider an answer during CI, is there an option to provide a default answer or skip these questions? Any help is appreciated. Thanks 🙂...
No description

schema types

for some reason in my schema.ts file i have an error ``` export const your_table_name = pgTable('your_table_name', {...
No description

Chain orderBy clause problem

I have a query that filters a table based on search params ```typescript const instructors = await db .select() .from(DBInstructors)...

NeonDB: Migration Taking Long

Hi, I have been using dirrzle with neon DB, and it has been a great experience. However, once I changed my schema a lil bit and migrate again, it was taking extremely long time and query is never executed. db/index.ts ```typescript import { neon, neonConfig } from "@neondatabase/serverless";...

I am getting typescript error when creating schema

No matter what column type i use, i get error for every type of column i add.
No description

Type errors with 0.28.3

When trying to move from 0.28.2 to 0.28.3 I'm getting the following type errors on the table (pgTable) fields/columns. Also attaching a .txt file of the error message....
No description

Automatically apply migrations on serverless deploy

I've got a basic Todo app using Turso DB and Nuxt: https://github.com/Amar-Gill/nuxt-todo I'm wondering if there is a way to automatically apply migrations when I deploy to Vercel? The build command is npm run build. Right now, I open a shell into my Turso DB and paste the migration scripts....

`migrate()` prints to stdout

When I run the migrate() function it always prints content to stdout, and I can't find a way to disable it. I'm using migrate in tests, and it's super annoying because it's polluting the console and making the test output difficult to read. Does anyone know a workaround for this?

0.28.3 types issue

is there a new way to handle typings in 0.28.3 i get type errors on my table builders and on 0.28.1 i do not

Custom type not inferring correct zod schema?

Shouldn't this return as an array of strings?
No description

Connection to SQL destroyed (after idle). Do I need to manually handle open + close for each query?

i deployed my SQL server and nodejs server on railway. The server is up and running, for some reason my SQL connection disconnected? I was wondering if I am missing something fundamental or what? ```database.ts import dotenv from "dotenv"; import { drizzle } from "drizzle-orm/mysql2";...

I can't create a simple table..

What am I doing wrong? ``` import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core"; ...
No description

Prepared statements with TRPC

Hi, I just read that to use prepare statements properly with a serverless environment I need to put my statements outside the scope of the handler. However I use TRPC with NextJS so all my queries are in the router of TRPC which end up in the handle, my question is:
Where should I put my prepared statements considering I'm using the db connection from the context of TRPC ?...

Conditional insert

Hi, Is there a way to do an insert only if the result of an exists statement is true ? I would like to do it in one query instead of having to check with another query before the insert. ...

DB connections hangs after successful execution in Lambda locally

I'm testing my lambda functions locally with sls invoke local -f hello. after returning a success response, my execution doesnt end attached a video that shows the behaviour if i remove the db query then it works fine...

Write

Is it possible to print a relational query to SQL?

Polymorphic Associations?

Hey all - I'm coming to drizzle-orm + SvelteKit from the Rails world. I want to have polymorphic associations, as documented here: https://guides.rubyonrails.org/association_basics.html#polymorphic-associations This is what I have in my schema.ts:...
No description

Nextjs edge middleware: Cannot import node:crypto

Vercel Github discussion with other users having the same problem using Drizzle: https://github.com/vercel/next.js/discussions/47314 Hello, it seems that Drizzle is attempting to import node/crypto and failing inside nextjs edge middleware functions. However, using the crypto global in edge functions/middleware is supported 👍 ...