Let's say I have the following pseudo-table I want to create in MySQL:
CREATE TABLE 'Stuff' (
'ID' bigint NOT NULL AUTO_INCREMENT,
'IsAThing' boolean NOT NULL,
PRIMARY KEY ('ID')
)
As of now (v8.0.x), MySQL doesn't actually have a boolean data type for this and instead, I need to use a TinyInt
. In the past, best practice was to use TinyInt(1)
, where the (1)
part isn't so much a data type but a default display configuration (i.e. only display 1 digit of the TinyInt number, even if it was storing the value 100).
However, these days, doing this gives you a warning that Integer display width is deprecated. This question is related but more specifically addresses the use of INT(4)
. The recommendation there is to either use INT
or to ignore the warnings. In that case, I think I would opt to just use INT
but my question is more specific to the boolean-equivalent usage.
What is the best practice for this boolean-like data type? Should I just use TINYINT
instead of TINYINT(1)
, given that the feature is now deprecated? Or should I be doing something different? My goal is to not use deprecated features for this new database that will likely live for years through future DB upgrades.