DT
Drizzle Teamjoostschuur
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.
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.3KMembers
View on DiscordWant results from more Discord servers?
More PostsConverting a field from X type to Serial causes errorsI'm attempting to convert a field from type `text` to type `serial`.
Here's the error I'm seeing:
`Return type is only "with" types, ignores "columns" typesNot sure if I'm using it wrong but the return type of a relational query is just the columns from th