-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm
are you using?
0.44.5
What version of drizzle-kit
are you using?
0.31.4
Other packages
No response
Describe the Bug
When trying to generate a schema.ts
using drizzle-kit pull
. I encountered two issues:
- Had some columns in my tables with default value as
jsonb_build_object()
. It could not parse it, output:
SyntaxError: Unexpected token 's', "sonb_build_object(" is not valid JSON
at JSON.parse (<anonymous>)
at defaultForColumn (/Users/yousefhanbali/Desktop/webapp/WebApp/apps/web/node_modules/drizzle-kit/bin.cjs:20054:55)
at /Users/yousefhanbali/Desktop/webapp/WebApp/apps/web/node_modules/drizzle-kit/bin.cjs:19618:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
This can be fixed by switching default value to {}
but it does not make sense to fail
- Had some columns with default value as
gen_random_uuid()
. This column is text, when not specifying a value it falls back to this method.
The schema generated successfully, but the output is not accurate. This is a pg function, but pull
treats it as a typescript method. Output:
id: text().default(gen_random_uuid()).notNull(),
It should be
id: text().default(sql`gen_random_uuid()`).notNull(),
Am I missing something here?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working