drizzle-team / drizzle-team/drizzle-orm

[BUG]: Default values for BigInt column causes do not know how to serialize a bigint when generating migration

Open
#3,609 1 comment 18 reactions 1 assignee Claimed by @L-Mario564 View on GitHub
bug bug/fixed-in-beta drizzle/kit has-pr priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [X] 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.31.2

### What version of `drizzle-kit` are you using?

0.22.6

### Other packages

_No response_

### Describe the Bug

### **When generating migration -**

If I add default value for BigInt column it causes this error:
TypeError: Do not know how to serialize a bigint

So if we add column like this:

```ts
column: bigint("column", {
mode: "bigint",
})
.notNull()
.default(0n);
```

that will then produce that error

But if we do it like this:

```ts
column: bigint("column", {
mode: "bigint",
})
.notNull()
.default(0 as unknown as bigint);
```

then it will work.

So it's not able to create proper json file from schema which prevents it to create SQL file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.