Drizzle Team

DT

Drizzle Team

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

Join

.prepare() in Next.js App Router

Hello! I'm trying to use PostgresQL prepared statement in the Next.js App Router and I have been getting stuck on "prepared statement already exists" Does anyone have an example I can refer to? It'd be a lot of help!...

Deleting records w/ sqlite-core.

Hello all, hoping to find some clarity/direction. So I'm trying to delete a record using; ```ts export async function acceptUserMail(mailItem: string) { return db.delete(mailbox).where(eq(mailbox.id, mailItem)).run(); }...

Can't figure out how to design relational query

I have three tables - categories - products - media ...

drizzle-zod@0.4.4 with drizzle-orm@0.26.5

added drizzle-zod to my project and I am getting this error when starting the dev server - error ./node_modules/.pnpm/drizzle-zod@0.4.4_drizzle-orm@0.26.5_zod@3.21.4/node_modules/drizzle-zod/index.mjs Attempted import error: 'is' is not exported from 'drizzle-orm' (imported as 'n'). ...

ERR_MODULE_NOT_FOUND while generating migration files

```ts import type { Config } from 'drizzle-kit'; export default { schema: './lib/db/schema/*',...

Typescript error with custom column type

The select rules throws a TS error: "Expected 0 arguments, but got 1.ts(2554)" What am I doing wrong?...

Infer TS types with `sql` operator and `db.execute`

``ts const db = drizzle(connection); export async function getTodos() { const result = await db.execute<Todo>(sqlselect * from ${todo}`); return result.rows;...

Migrations not working with Neon.Tech?

So i was trying to use drizzle for the first time. a little bit of a noob but im not sure what im doing wrong here. when i go to neon i can see the compute starting so it seems like there's a connection happening, but the actual table is not created? I tried using the neon driver first and couldn't get it working. and when i print my connectionString i see it properly using tsx to run the file Can anyone help? ...

Cannot read properties of undefined (reading 'connectionString')

In my drizzle.config.ts I have the code: ``` import type { Config } from "drizzle-kit"; import 'dotenv/config' ...

help with drizzle types not inferred well

``` async function addTopic(topic: string, content: string, parent?: string) { try { let parentId: number | null = null await db.transaction(async (tx) => {...

Invalid input for drizzle-kit pg:inspect

I'm running a command I've run a couple dozen times before, but now am getting an error saying I need a configuration file for drizzle kit. I added a basic configuration and am getting a generic error saying "invalid input." My drizzle.config.json has a basic out and schema entries, and I double checked the postgres URI is correct....

Invalid input Only "mysql2" is available options for "--driver"

I'm trying to run drizzle-kit introspect:mysql by following the docs and I have the config file: ``` import type { Config } from "drizzle-kit"; import dotenv from "dotenv";...

What is the type of transaction prop?

When creating a transaction I get this prop ```ts const transaction = client.transaction((tx) => {
})...

Unexpected type mismatch for sqlite integer boolean mode

Hi, you guys added boolean support for sqlite recently (thanks for that!!). It correctly expects 0 and 1 as the values in the db but I've noticed when using a default(0) it throws a ts error (see below). Setting it as a boolean default(false) does not. I'd expect to set a value in line with the expectation but perhaps my understanding is wrong? Is it a bug? ``` export const foo = sqliteTable("foo", {...

AWS Aurora MySql via AWS Data API

Is there a way to use drizzle with AWS Aurora MySql via the AWS DataAPI? I can see the option for PsotgreSQL in the documentation, but nothing about MySQL: https://orm.drizzle.team/docs/installation-and-db-connection...

Support for unsigned integers

Does Drizzle ORM support defining unsigned integers in the schema?

Why is insertId a string, not a number?

After inserting into a table with an auto-incrementing pk, the insertId in the returned ExecutedQuery is a string. Why isn't it a number?

Auto update for updated_at

Any thoughts on how I could implement an auto updated field triggered on updates only on Postgres? I see onUpdateNow() for MySql. Seems Postgres supports triggers for this. Can/should I use Postgres triggers via Drizzle? If not, does it make sense to send the updated_at over the wire from the client?...