drizzle-team / drizzle-team/drizzle-orm

[BUG]: drizzle-kysely requires inserted JSONB columns to be stringified since 0.33.0

Open
#2,979 0 comments 3 reactions 0 assignees View on GitHub
bug priority qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.33.0

### What version of `drizzle-kit` are you using?

0.24.2

### Describe the Bug

I'm using drizzle-kysely. Schema is defined in drizzle, and I write my queries using Kysely.
I'm using Postgres.
When I upgraded to 0.33.0, any queries that were inserting a jsonb column broke.
I found that I now have to JSON.stringify the POJO before passing it to the Kysely query.
I didn't have to do that before 0.33.0 and it looks like it's not necessary for a native drizzle query, only when using drizzle-kysely.

Is this by design? Seems like a step backwards.

### Expected behavior

I expected to be able to write:
```javascript
const identity = await db
.insertInto('c_field_definition')
.values({
name: values.name,
type: values.type,
config: values.config, // <-- jsonb column
})
.executeTakeFirstOrThrow()
```
but instead I now have to write:
```javascript
const identity = await db
.insertInto('c_field_definition')
.values({
name: values.name,
type: values.type,
config: JSON.stringify(values.config), // <-- jsonb column
})
.executeTakeFirstOrThrow()
```

### Environment & setup

PostgreSQL via Supabase.
Sveltekit 2 running in dev mode on WSL2
Kysely 0.27.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.