Closed twiddler closed 6 months ago
Hey! So this adapter doesn't change the types returned from the database driver (https://github.com/planetscale/database-js) - what you're seeing here is the DB driver trying to determine if the database number is representable as a JavaScript number or not. Specifically, 64-bit numbers are not representable as JS numbers so they get returned as strings. Depending on the query, the PlanetScale driver may not be able to determine if the number is safe, so it gets returned as a string.
If you have any questions about how that's working, you may want to open an issue at https://github.com/planetscale/database-js. You can also intentionally modify the types from the DB driver with a custom cast
function if you'd like: https://github.com/depot/kysely-planetscale#custom-cast-function.
In the following test suite, when using
PlanetScaleDialect
and receiving more than one row, what should be numbers is parsed as strings instead:Gist for reproducing: https://gist.github.com/twiddler/8f98b48ec61c75eaa5422249c1edebc9. Please set
PLANETSCALE_URL
in.env
and use Node 21 or later.