drizzle-team / drizzle-team/drizzle-orm

Feedback for “Cloudflare D1” with Blobs

Open
#926 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

Have you tried expanding this example to use a table with blobs? D1 is not that happy with it.
I'v tried it with miniflare local development, and cannot select from the table with blobs.
`SyntaxError: Unexpected token , in JSON at position 3`

```
import { blob, integer, text, sqliteTable } from "drizzle-orm/sqlite-core";

export const userBlobs = sqliteTable('user_blobs', {
id: integer('id'),
name: text('name'),
roles: blob('roles', { mode: 'json' }).$type<{ foo: string }>(),
jobs: blob('jobs', { mode: 'json' }).$type()
});
```

Did not deploy to cloudflare yet to see if it works there.

https://developers.cloudflare.com/d1/platform/client-api/#type-conversion
Could be a miniflare problem locally.

There are tests and scripts that explains it here:
[drizzle-orm-samples](https://github.com/gerhardcit/drizzle-orm-samples)

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.