Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • ¿so it could make sense to create a boolean with a check like is_true boolean NOT NULL CHECK(is_true IN(TRUE, FALSE)) right? Commented Mar 3, 2023 at 20:21
  • 1
    @CanRau indeed, to be safe against any application that tries to insert 2 or 3 or 17 into such a column or cannot handle properly such ill values. And assuming that you are on a recent enough version of MySQL that has implemented CHECK constraints (old versions do not). Commented Mar 4, 2023 at 13:21
  • Thanks for confirming 🙏 yes I'm on MySQL 8 (Planetscale) good to know about the compatibility requirement Commented Mar 4, 2023 at 14:17
  • Just wanted to add to my question if I should also mark it as boolean UNSIGNED, if that would help with anything, but then found this answer stackoverflow.com/a/74376677/3484824 so it seems better to be avoided as bool/boolean are synonyms of tinyint(1) and not tinyint(1) UNSIGNED and libraries and ORMs might depend on this Commented Mar 6, 2023 at 15:19