default to empty object for sqlite text field with JSON mode
How can I default a
mode: 'json'
text type to an empty object in sqlite?
The following in a sqliteTable
definition results in a literal string of ([object Object])
:
Empty arrays are discussed here, but not empty objects:
https://orm.drizzle.team/learn/guides/empty-array-default-value#sqlite
Using default(sql
'{}')
(with backticks around the single quotes, I can't get the to show up in Discord markdown) or default('{}')
defaults it to a literal '{}'
, and querying that gives an error:
I'm using drizzle-orm": v0.30.9 and Turso/libsql.Drizzle ORM - Empty array as a default value
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
0 Replies