sqlite DEFAULT is not JSON-encoded
When using
text("...", { mode: "json" })
with .default()
, the default value is not JSON encoded leading to invalid SQL generation by drizzle-kit.
generates:
(should be '""'
instead)
Using an empty array .$type<string[]>().default([])
generates nothing:
(should be '[]'
)3 Replies
We need to improve the interface of the
.default
function. You can't use a JavaScript array there, you are suppose to use SQL.The types disagree a bit there,
.$type<string[]>().default("[]")
is a type error
The sql
templating function is required here for typescript to not scream at meYes, you would need the sql operator