Drizzle Team

DT

Drizzle Team

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

Join

[Solved] cannot find package 'mysql2'

I've setup drizzle with a planetscale db and pushed a simple user schema, however running the pnpm drizzle-kit studio command as indicated in the docs comes back with the following error
Cannot find package 'mysql2' imported from C:\Users\username\Desktop\testProj\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\drizzle-orm\mysql2\index.mjs
Cannot find package 'mysql2' imported from C:\Users\username\Desktop\testProj\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\drizzle-orm\mysql2\index.mjs
does anyone know why ?

Error: this.client.prepare is not a function

I am trying to build a project using Bun, Hono and Drizzle. When i am starting the project with this piece of code : ```ts import { Hono } from 'hono' import postgres from 'postgres';...

pg: introspect fails

So I have some tables that do not have a primary key constraint (by design) and it seems that drizzle introspect fails whenever it reaches one of those tables. Is this intended or is there a way around it? Thanks!

client connection refused

I'm using bun. I was able to get the pool connection working, but the same connection configuration for the client connection option fails with a "error: Failed to connect" /n "code: "ECONNREFUSED". Any ideas?...

Running migrations in server-less (edge) land??

According to the docs: ``` // this will automatically run needed migrations on the database await migrate(db, { migrationsFolder: './drizzle' });...

Is there any way to call drizzle-kit with the new node --env-file=.env argument?

Hey, since node supports env files since pretty recently, it would be nice if we could ditch dotenv. Now I only require dotenv to inject the environment variables to drizzle.config.ts to allow drizzle-kit to db push 😄

enumerating tables

I have a table of possible 'statuses' for a column in my records table and would like my zod schema to see what statuses are available to set. Is this possible? I'm aware we can create an ENUM column on my records, but it 'feels' better to have a separate table for this. I guess I'm looking for an 'in-between' an enum column and a separate table. Maybe it's possible to predefine/lock-in the statuses in the application layer, is it bad practise? I'm new to db stuff so unsure on the best approach....

how to group Related Items

```typescript // index.ts const coursesList = await db .select({ title: courses.title, tags: tags.tag })...

Nested where filter, how to not include empty

The following almost works ``` const query = db.query.productionItem.findMany({ with: { itemStages: {...

is placeholder in prepare statements deprecated!??

```typescript const courses = db.query.userCourses .findMany({ where: eq(placeholder("userId"), userCourses.userId), columns: {},...

SQLite json_each

Hi. I wandted to use the json_each function in sqlite, but I dont think the query is building correctly, could someone please guide me in the right direction? My table: ```ts export const channels = sqliteTable('channels', {...

Foreign key truncated for being too long?

Hi, I have multiple warnings / notices: `{ severity_local: 'NOTICE',...

drizzle-zod with custom types

I have defined opaque types in my application and have implemented those in the drizzle schema (awesome and easy to use!). The opaque types are defined using zods Brand feature i.e. z.string().uuid().brand<"SomeId">(); I have that defined in the drizzle schema as someId: uuid("id").$type<SomeId>().notNull() When I use drizzle-zod to create the schema and infer the type, it's coming back as a z.ZodString rather than z.ZodBranded. ...

Using transactions in automated testing like Jest

I have a testing set-up as follows: 1. Start postgres container 2. Apply migrations to db 3. Jest test that connects to the postgres container...
No description

TypeScript complaining about using a spread operator in partial select query

TypeScript complaining about me using a spread operator in partial select query. I have the following query joining data on two tables, userData and users. The query works as intended on the client side but TypeScript is complaining about me using a spread operator ...userData, (line 3) with TS2345: Argument of type [...] is not assignable to parameter of type  SelectedFields ```...

Unable to read error message when inserting withdb.insert().values()

Hey there, i am using visual studio code and am developing with nuxt3. I am trying to insert an object but I am getting an error message that is very difficult to read. Am I doing something wrong? I have no idea what's wrong looking at this.....

how to add new driver to drizzle?

what is the procedure of adding a new driver to drizzle orm?

`drizzle-kit --custom` is not giving me a blank migration file

I'm doing the following:
drizzle-kit generate:pg --custom
drizzle-kit generate:pg --custom
...

No id returned (mysql2)

async function create(data: NewBusiness) {
return client.insert(business).values(data)
}
async function create(data: NewBusiness) {
return client.insert(business).values(data)
}
...

Studio when using Turso `Error: Cannot find module 'better-sqlite3'`

Error when trying to start Studio and push Error: Cannot find module 'better-sqlite3'...