Re:Ask HN: Do You Use Enum for Yes, No, Unset?
by adzm on Friday June 17, 2022 @04:39PM
(#31784010)
For SQL there is usually an optimization where nullable columns are simply a bit set; same with boolean/bit columns. This does sound like a good use of a nullable bit.
You may want to distinguish things further in the future such as adding a new column and you can determine if it was unset/undefined by the user versus null because the user never saw it. In that case an enum makes sense.
Personally I think the logic maps directly to nullable bit.
You may want to distinguish things further in the future such as adding a new column and you can determine if it was unset/undefined by the user versus null because the user never saw it. In that case an enum makes sense.
Personally I think the logic maps directly to nullable bit.