Invalid serialization of JSON blobs

Has anyone gotten default values of JSON blobs to work with SQLite?

When I try using an empty array, the SQL migration does not have a default value (despite having the DEFAULT keyword).

array: blob("array", { mode: 'json' }).$type<string[]>().default([]).notNull()


`array` blob DEFAULT  NOT NULL,


If I use an object, the default value is the toString serialization: [object Object], not the JSON.stringify serialization.

object: blob("object", { mode: 'json' }).$type<{}>().default({}).notNull()


`object` blob DEFAULT [object Object] NOT NULL,


I also posted an issue on GitHub since this seems like a bug, but asking here in case any of you have found a workaround.

https://github.com/drizzle-team/drizzle-orm/issues/1036
GitHub
What version of drizzle-orm are you using? 0.28.2 What version of drizzle-kit are you using? 0.19.12 Describe the Bug I have the following schema: array: blob("array", { mode: 'json&#...
[BUG]: SQLite JSON blog with empty array produces invalid migration...
Was this page helpful?