One factor to consider is whether the people who wrote the source schema restrict MySQL or not. If it is intended only for work in MySQL, then adaptation to MySQL makes sense. If the same schema is intended for use with other DBMSs, then a more general schema design that works in all relevant DBMSs may be better for people creating the design.
With that said, enum
has moderate MySQL specifics, but something that is equivalent to enum
can easily be created in another DBMS:
CREATE TABLE ... ( ... FlagColumn CHAR(1) NOT NULL CHECK(FlagColumn IN ('y', 'n')), ... );
The way that different DBMSs handle BOOLEAN is not as unified as you would like, SQL Standard, despite this (and the reason, as always, is history, less compatible systems had a variation on BOOLEAN before the standard did, and changing their implementation violates code of their existing customers).
So, I would not automatically blame the use of enum
over boolean
, but it is better to use boolean
for boolean flags.
source share