drizzle-team / drizzle-team/drizzle-orm

[BUG]: RC4 introduces new bug by setting `supportBigNumbers` to `true` with the `mysql2` driver

Open
#5,972 4 comments 0 reactions 0 assignees View on GitHub
bug
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?

1.0.0-rc.4

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

1.0.0-rc.4

### Other packages

_No response_

### Describe the Bug

`drizzle-orm@v1.0.0-rc.4` introduces a bug [here in this commit](https://github.com/drizzle-team/drizzle-orm/commit/efa079fd3c0a71ec3666012bb24b979d5be2cb0c#diff-c51eced41e87bd5bcc404b1414b70b4f47adea06c57183fa49ce4d12db9a051d) where it adds a line in the `mysql2` driver:

```ts
client.config.supportBigNumbers = true;
```

I've found this to cause an issue because the `client` property in the object passed to `drizzle()` does not have a top-level `config` property:
```ts
const poolConnection = mysql.createPool({
host: dbConfig.host,
port: dbConfig.port,
user: dbConfig.username,
password: dbConfig.password,
database: dbConfig.databaseName,
connectionLimit: dbConfig.connectionPoolLimit,
enableKeepAlive: true, // default value but set just in case: https://github.com/sidorares/node-mysql2/issues/1898
ssl: {
rejectUnauthorized: false
}
});

...

export const db = drizzle({
client: poolConnection,
logger: new DbLogger(),
relations
});
```

However setting the `client` property to `poolConnection.pool` seems to fix this issue because the top-level `pool` property does indeed have an object that contains the `config` property. If this is intended, it should be properly documented, which [it is not right now](https://orm.drizzle.team/docs/mysql/get-started-mysql).

Contributor guide

Open the contributing guide

Research direction

Start at the linked commit and inspect the mysql2 driver change that sets client.config.supportBigNumbers, comparing it with the poolConnection example in the issue. Verify the shown drizzle({ client: poolConnection }) setup and the poolConnection.pool alternative, then update the driver behavior or the MySQL getting-started documentation so the supported client shape is clear and the reported error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, typescript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.