Drizzle doesn't know how to serialize a bigint

When using a defaultValue for a bigint like this:
storage: bigint('storage', {mode: 'bigint'}).default(262144000n).notNull(), // 250mb in bytes
storage: bigint('storage', {mode: 'bigint'}).default(262144000n).notNull(), // 250mb in bytes
I will ge the following error when generating the schema:
TypeError: Do not know how to serialize a BigInt
TypeError: Do not know how to serialize a BigInt
I am using postgresql
Solution:
Try without the n ? I guess it is only a JS thing right?
Jump to solution
5 Replies
B33fb0n3
B33fb0n3OP7mo ago
bump
rphlmr ⚡
rphlmr ⚡7mo ago
Hello, Would you try this?
.default(sql`'262144000n'::bigint`)
.default(sql`'262144000n'::bigint`)
B33fb0n3
B33fb0n3OP7mo ago
Yes, that works! But only for the drizzle kit. When I try to push it, I get the following error:
error: invalid input syntax for type bigint: "262144000n"
error: invalid input syntax for type bigint: "262144000n"
Solution
rphlmr ⚡
rphlmr ⚡7mo ago
Try without the n ? I guess it is only a JS thing right?
B33fb0n3
B33fb0n3OP7mo ago
That worked 🥳 I guess it is, yea. Thanks for your help ❤️
Want results from more Discord servers?
Add your server