Drizzle Team

DT

Drizzle Team

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

Join

Issue with schema migration on neon

Hi, I want to migrate schema of my database. I have a table called "tokens" to which I want to add two columns. I'm running the following command:
yarn drizzle-kit generate --config ./drizzle.neon.config.ts
yarn drizzle-kit generate --config ./drizzle.neon.config.ts
And this is the config file: ...

Drizzle-zod schemas included in bundle

Hey all, I am working on a package that exports a ts-rest contract. The contract uses zod schemas to validate inputs. The schemas are created with createSelectSchema from drizzle-zod in my schema.ts file: ```ts export const clients = pgTable( "clients", { ...

Error running `drizzle-kit push` after schema update

This is my first time using Drizzle. After making my first schema change, the generated SQL code contains errors. ``sql DROP TABLE new_leads; CREATE TABLE new_leads` (...

Authentication Issues with Postgresql, Docker, WSL and Drizzle

Hi Guys, I have an issue where WSL network authentication fails with pg driver with drizzle-kit. I've been spending hours trying figure out but unable to find a solution. Is there any work around to this? Or do I need to manually create each table? Thanks~...

Issues on first migrate after pull

Hello! I am getting an error after trying to do a migrate on a database I just pulled using drizzle-kit, seems to be something related to the commenting syntax being used. I have seen some workarounds online but I was wondering if there is maybe a smarter way to go about this or if it's mapped as an issue to be fixed. ``` āœ— npx drizzle-kit migrate --config=drizzle.config.ts
Reading config file '/Users/pc/Dev/service/drizzle.config.ts' Using 'pg' driver for database querying...

Error when npm install drizzle

Hi, I am having an issue when installing drizzle. I am using nuxt 4 js with sidebase v1.1.0, and it seem that there some conflict between sidebase and drizzle package.json ``` {...

Update many rows

Is it possible to update many rows in the table using db.update(table).set(...).from() ? Specifically I want to achive this sql query: ```sql UPDATE users u...

Neon Column Name Collision on Migrate

Hey folks, I'm developing a project using Neon PostgreSQL with drizzle in the client side. I added a column in my table three days ago, which is called "status", that was done through the drizzle schema. I ran db generate, migrate and push, but I'm not sure if it worked at the time. In my Neon __drizzle_migrations table I can only see one entry. In my local _journal, I have two entries. Whenever I try to migrate now in my local database it returns a long error: ``` ......

drizzle studio initial load works, then everything after fails

when I start drizzle studio, then the initial load works, but if I click on a table, then it freezes and eventually gives the error ``` AxiosError: Request aborted at R.onabort (https://local.drizzle.studio/index.js:101952:6003) at fU.request (https://local.drizzle.studio/index.js:101954:2098)...
No description

Integration tests with Deno and drizzle

Hello, I'm wondering what's the best approach when dealing with integration tests using PostgreSQL+ Drizzle. I'm using deno and I get an error each time I try to access my database as I don't close the connection because I rely on the global db instance (which I believe seems to be the pattern illustrated in the docs?). If I close the connection after a test, the other tests just break with
Caused by Error: Cannot use a pool after calling end on the pool
Caused by Error: Cannot use a pool after calling end on the pool
. If I don't close the connection Deno gives me the ``error: Leaks detected: - A TCP connection was opened/accepted during the test, but not closed during the test. Close the TCP connection by calling tcpConn.close()`....

drizzle-kit push tells me it found data-loss statements and asks me to confirm to delete tables : /

I don't get why this command wants to delete my tables... All the tables in the image below belongs to my public schema. Could anyone tell me why ? This is basically all I'm doing... ...
Solution:
Oh, I think I found why here... https://orm.drizzle.team/docs/drizzle-kit-push#including-tables-schemas-and-extensions Seems that defining your schema name with pgSchema is not enough if you're doing drizzle-kit push because it defaults to public schema...

TypeScript type of a table that *always* has a numerical "id" column?

Hello. I'm new to TypeScript and Drizzle, and I'm struggling to describe the correct TypeScript type representing a Drizzle Table that always has a numerical "id" column (the primary key essentially). What I'm trying to do here is to create a generic class parametrized by a table type T that extends from the above constraint. It would feature a findById method that can safely access the "id" property and return a record of type InferSelectModel<T>. Roughly:...

drizzle studio in vps

hello there, i use vps, connect it with vscode tunnel, when i run pnpm drizzle-kit studio --host 0.0.0.0 tunnel forward port, and when i visit that forwarded port url, instead of studio ui i get '404 Not Found'

"Expected 0 arguments, but got 1."

I have a query:
const rows = db.select({ id: user.id }).from(user).where(eq(user.name, name)).limit(1);
const rows = db.select({ id: user.id }).from(user).where(eq(user.name, name)).limit(1);
...

String concatenation syntax

Is there a better a way to concatenate strings in the select of a query? I'm currently doing this: ``ts const bucketUrl = ${env.MINIO_ENDPOINT}/${env.MINIO_BUCKET_NAME}/${RESOURCE_PREFIX}/`; ...

Problem - Create enums on a file or folder outside of the table

I have a table, and I wanted to test creating enums in a separate folder to share them across multiple tables. The issue was that when I ran drizzle-kit push, I got the following error:
error: type "reservation_status" does not exist
error: type "reservation_status" does not exist
...

Drizzle create an pg enum with an object as const, should return an error ?

According to the docs I usually create an enum with values like this: ```ts export const COMMON_AREA_TYPE_VALUES = [ 'public',...
No description

top level await workaround in drizzle.config?

i've read a bunch of gh issue threads about this, and haven't really found a workaround for when i strictly need to await the loading of credentials. does anyone have a workaround?

Docs for Drizzle Studio v0.19

Looking for these docs or someone who can help me set it up again... Thank you...

Can't find meta/_journal.json file

HI, Im refactoring a project to now use src folder, after putting everything into the src folder, and pre-pending ./src where necessary, i get the error Can't find meta/_journal.json file my drizzle.config file: ```ts...