What does MySQL bigint config mode do?

In a mysql schema, when creating a bigint, it wants a config object with a mode key where mode could be number. What does this do?
5 Replies
bloberenober
bloberenober16mo ago
It's a bug, will fix shortly There are two modes for bigint columns bigint and number, depending on what you need to operate on in your code Even though autocomplete only shows number, you can use bigint and it will work correctly. It's an issue with the autocomplete only.
kelbs
kelbs16mo ago
So I should set it to bigint always? I'm more asking what happens if I change the config mode? What does it control?
bloberenober
bloberenober16mo ago
It controls whether you'll have to operate on number values or on BigInt values. Set it depending on what you need. Numbers in JS only support values up to 2^53, and BigInt supports up to 2^64. So if you don't need values higher than 2^53, it's more convenient to use the number mode.
kelbs
kelbs16mo ago
Gotcha, thanks!
bloberenober
bloberenober16mo ago
@kelbs btw, the types should now be fixed in drizzle-orm@beta, the autocomplete should correctly contain both bigint and number options.