tinyint(1) converted to number
TilmannBaumgarten opened this issue · comments
Working with planetscale/mysql, tinyint(1) columns are converted to the number
type. Is this intended? How do I generate booleans?
Hey 👋
MySQL doesn't have a boolean data type. You typically define boolean columns with the tinyint(1)
data type and use 1
for true
and 0
for false
. tinyint(1)
can also be used to store small numbers as it accepts numbers between [-128, 127].
kysely, kysely-codegen and any MySQL compatible driver out there cannot tell if you're using that tinyint(1)
column as a boolean, or as a small number column.
Perhaps a good approach would be to allow users to override with the SqlBool
type that Kysely exports, or provide a flag that does it automatically.
From what I can gather, this is a duplicate of #30.