Open SupremeTechnopriest opened 2 weeks ago
@SupremeTechnopriest , I've went down this road, solved it with text column.
const table = sqliteTable('table', {
id: integer('id').primaryKey(),
jsonCol: text('json_col', { mode: 'json' }).$type<string[]>()
}
https://orm.drizzle.team/docs/column-types/sqlite#blob The docs recommend text for json as well.
Yeah Im a little deep into the blob right now and the migration would be a nightmare to change to text. I didnt need json functions so I thought blobs would be fine. Im pretty sure this worked at one point.
What version of
drizzle-orm
are you using?0.31.2
What version of
drizzle-kit
are you using?0.22.7
Describe the Bug
Trying to insert an object into a blob JSON column fails. It has to be encoded as a string first, but this results in type errors:
Expected behavior
Should be able to insert a javascript object and have it stringified under the covers.
Environment & setup
I'm using D1. It happens local with drizzle studio and I assume in production as well.