Drizzle Team

DT

Drizzle Team

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

Join

Updating jsonb objects with Drizzle?

Hey there, i'm currently working on migrating my database and code from MongoDB with Mongoose to Postgres with Drizzle and have encountered a question that I couldnt find answered on the docs. I query JSON like this in my MongoDB database ```ts Profiles.findOneAndUpdate({ accountId: user.accountId }, { $set: { "profiles.athena.items": allItems.items } }, { new: true }, (err, doc) => { if (err) console.log(err);...

auto updated_at

is there a way to automatically update the updatedAt column of a postgres table ?

Fulltext index MySQL

How can I define a fulltext index with MySQL? there is no fulltextIndex available in mysql-core.

You're about to add not-null version without default value

I added this column
version: int("version").notNull().default(0),
version: int("version").notNull().default(0),
and it's trying to truncate because it thinks there's on default value...

Cannot read properties of undefined (reading 'columns')

``` /home/thdxr/dev/projects/bumi/bumi/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs:11810 result[key].columns[value[0]].primaryKey = true; ^ ...

neon coldstarts in vercel edge

hey!! if my neondb is in idle state, and i try to query something -- it will error out. - error node_modules/@neondatabase/serverless/index.js (1527:67) @ eval - error error connecting to server: Connection refused (os error 111) `Caused by:...

Module '"drizzle-orm/mysql-core"' has no exported member 'unique'.ts(2305)

Getting this error when trying to import unique ```typescript import { text, unique, // erroring out...

Is there a way to set the index operator type for postgres?

I'm migrating our project to drizzle, and I want to add the indexes to the table. Previously we were using Sequelize and we had an index on a jsonb field with jsonb_path_ops operator. Is there a way to do the same in drizzle?...

How to update multiple rows with one query?

Take this array as an example: ```ts const data = [ {id: 1, col1: "col1 data where id = 1"} {id: 2, col1: "col1 data where id = 2"}...

Use Drizzle in NestJS app

Hi everyone ! I am new to both drizzle and NestJS and was wondering if there was any recipe out there to use Drizzle in NestJS (I couldn't find anything) should I create a service or something ? (as Prisma ?)...

[Solved] Transforming const to the configured target environment ("es5") is not supported yet

So I had a old project, and I copied the DATABASE_URL and on created a basic drizzle project and drizzle.config.ts I got a schema created. Now, I copied the schema.ts file and pasted it into my new (second/another) project. I ran npx drizzle-kit generate:pg but I got the error Transforming const to the configured target environment ("es5") is not supported yet 55 times (55 is the number of tables that I have) 🥹 PLS HELP...

Placeholders in inserting: db.insert().values(placeholder('example'))

Hey, how do I add placeholders inside the values of an insert prepare statement? I get an typeerror when I do so.

Can I add a Unique constraint to a column?

I couldn't find an option for that in the docs. I'm assuming Drizzle doesn't support that. So, could I just edit one of the migration SQL files myself and add the UNIQUE constraint to it? Or would that break things?...

"Cannot parse date or time" using AWS Data API, aurora postgres

I'm trying drizzle-orm (with sst) and aurora pg thru aws data api, when trying to insert a Date value in a column (timestamp with timezone), I'm getting this error. I wonder if the problem is the way Date is being serialized (looks like it's not using ISO date string?) this shows the response coming from aws-data-api ```...

Filtering against a relation

I have a orgs table that have a many to many relation with a users table. while querying with the findFirst method how can i filter against the relation so that I only return an org if the user have access to it....

Get type for select query?

Hey guys, is there a way to infer the "select" type for a given table? for example: ```ts async getUsers(selectColumns: ?) { return this.db.select(selectColumns).from(users)...