MEPX
Chapter 2 of 10All chapters

Chapter 2 of 10

Tables, rows and types

The basic shapes.

Choosing types

Every column has a type, and picking the right one is a form of validation. Dates in a date column can be compared and sorted; dates in a text column cannot be trusted at all.

  • Store money as a decimal or as integer minor units, never as a float.
  • Store timestamps in UTC and convert for display.

NOT NULL and defaults

Deciding which columns may be empty is a design decision, not a detail. Every nullable column is a branch someone has to handle for the life of the system.