Typed JSON?
Opened this issue · 2 comments
sgup commented
Hi, is there a way to support typed JSON's ?
I added custom types in my drizzle schema (https://orm.drizzle.team/docs/column-types/pg#jsonb), but unfortunately they get overwritten with every change/generate.
fdarian commented
You can use drizzle.custom
directive for now. Please let me know how the syntax feels.
sgup commented
Hmm, not working for me:
schema.prisma
/// drizzle.custom {
/// "$type": "{ month: string, min: number, max: number }[]",
/// }
tempRanges Json?
I'm trying to generate this in drizzle.schema
:
tempRanges: jsonb("tempRanges").$type<{ month: string, min: number, max: number }[]>(),
I tried wrapping with <>
as well in the comment.