Drizzle Team

DT

Drizzle Team

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

Join

Sharing zod schema between api and front-end

Im looking to build an app using nextjs and drizzle orm. I was wondering if I could use the zod schemas generated from drizzle-zod. My main concern was the "pollution" of the front-end bundle with back-end stuff. I wouldn't like people looking at my database schema or something unintended

How to use JSON field in query

I've already made an issue on GitHub kind of pertaining to this issue, but I don't know if its actually a bug or if I'm just not using it correctly. Reference: https://github.com/drizzle-team/drizzle-orm/issues/463 ...

MySQL, PG proxy driver

@Andrii Sherman Hi, Andrew! I noticed that the April milestone for drizzle-orm includes MySQL and PG proxy drivers. I was just wondering if these features are still expected to be released within this month. ...

How to create tables?

So my understanding is that running a "migration" means creating the table with the schema in your db.
My understanding is the code below should do it as per the docs. I've also separately run npx drizzle-kit generate:pg beforehand to generate my schema. ```js // db.ts const pool = new Pool({...

onUpdateNow usage

is onUpdateNow simlar to prisma's @updatedAt ? I.e., updated_at col is auto-updated. If so, is there an example usage? Thanks!

ERR_PACKAGE_PATH_NOT_EXPORTED on 0.25.1

Just updated for the new ESM support, and noticed I can no longer generate migrations (See image) I've updated all my import paths to take advantage of ESM, and the schema works fine outside of kit (i.e. just using it in my monorepo normally)...

UPSERT many ?

I have a table called crmCompanies containing companies from my client's CRMs. Each day, I receive an array with all of the companies of my client. The thing is: I need to insert a new company in crmCompanies if it doesn't exist otherwise, update all its values. Here's the syntax from the docs (https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/README.md#upsert-insert-with-on-conflict-statement);...

missing type declarations in mysql-core imports (>v0.25.1)

after upgrading drizzle-orm to v0.25.1 i get some errors in my schema telling me that drizzle-orm/mysql-core/indexes, columns and table all have missing type declarations, any idea why that might be happening?

drizzle-orm@0.25.0 broke edge support

Seems like the ESM Support broke some stuff in the edge runtime land. This my vercel build output with drizzle-orm@0.25.0:

Does Drizzle support type CUID?

In Prisma i can use: id String @id @default(cuid()) Do we have similar solutions?...

Get column name in error messages

Is there a way to get column names exactly where the query is failing, for example when the FOREIGN KEY CONSTRAINT fails

Using Drizzle as a package in Turborepo doesn't work ?

I have a monorepo (Turborepo) with a shared package called @mono/database in which I put my drizzle schema and my types. I'm testing a query on an app of this monorepo (a simple Node.js folder with TS files), and I also run the exact same query (with the same exact drizzle client definition) from my package to test it out. The thing is: the query works perfectly when ran from my package but outputs an error when run from my app that uses the content of the package. When I run the query from my package directly, the logger it outputs the beautiful SQL statement complete with all the tables and fields....

Argument of type 'Database' is not assignable to parameter of type 'D1Database'.

I'm trying to use drizzle with cloudflare d1 but getting this error. Any help?...

drizzle-zod update schema?

is there any plan for createUpdateSchema from drizzle-zod?

How to reproduce a Prisma `include` statement for arrays of related entities without SQL?

Hello, I'm trying to translate this SQL query to DrizzleORM; ``` SELECT...

many-to-one selection as array

Hi, Let's say I have a user table, and the user can have multiple profiles. When I select using join on user_id I get back two records like so (pseudo-code): ```...

Alias in from() change? (SQLite)

Did something change wrt using aliases in from()? Until recently I've been using aliases to affect the resulting object, but it seems to have stopped working as it did before. Previously: ```ts const user = alias(User, "user"); const parent = alias(User, "parent");...

Table definition has 'any' type

I'm defining all of my tables in an index.ts file; but on some tables like visitor_events I get this errors; 'visitor_events' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. On other tables however, I don't have the error and the PgTableWithColumns is correctly infered. ...

CTE query of hierarchical data

I'd like to drizzle-ize this query: ```sql WITH RECURSIVE Child(n) AS (...

createInsertSchema wrong type (drizzle-zod 0.3.1, sqlite))

After upgrading to 0.3.1, all of the fields changed to ZodTypeAny