Shikhil Saxena

Nov 03, 2025 • 1 min read

You should stop using booleans in your database

🧠 Core Argument

While booleans (true/false) seem like a natural fit for binary decisions (e.g., isActive, isDeleted), they often fail to capture the nuance of real-world workflows. The author suggests replacing them with more expressive data types like datetime, enum, or status fields.

🔍 Key Points

  • Booleans are limiting: A true/false flag doesn’t tell you when something changed or why. For example, isVerified = true lacks context — when was it verified? By whom?

  • Better alternatives:

    • Use a verified_at datetime instead of isVerified

    • Use status = ['pending', 'approved', 'rejected'] instead of isApproved

    • Use deleted_at timestamps instead of isDeleted

  • Future-proofing: What starts as a simple boolean often evolves. Adding new states later (e.g., suspended, archived) requires schema changes and code rewrites.

  • Debugging and auditing: Timestamps and enums provide richer data for logs, analytics, and debugging.

Join Shikhil on Peerlist!

Join amazing folks like Shikhil and thousands of other builders on Peerlist.

peerlist.io/

It’s available... this username is available! 😃

Claim your username before it's too late!

This username is already taken, you’re a little late.😐

2

2

1