Let's talk

Topic

Data Modelling

Schemas, constraints and keys, and the rules they are really enforcing.

35 articles

About this topic

Most of the expensive bugs in an operational system are modelling decisions that were made quickly and then lived for years. Whether a balance is stored or derived, whether a soft delete has a defined answer for every child row, whether a foreign key is a business rule or a convenience — none of these announce themselves at the time, and all of them are discovered later by an accountant.

The recurring theme here is that a constraint is a claim about the world, and it is worth checking the claim before enforcing it. A check constraint that made over-delivery impossible to record did not stop lorries arriving with more than the order; it stopped the system being able to say so. That is worse than the problem it was written to prevent.

A dealer at the back of a delivery van placing a first order on the new-order screen in Sazinga Field on a phone.

Every booking scheme lost its last day

A booking window ran to 5 September. On that day a dealer placing a first order was told it had closed. Every scheme the company had run had lost its last day.

A monitor on a desk in a warehouse showing the orders list in the Sazinga Field portal, where promotion dates have to match the business clock.

Why a promotion ended at the wrong hour

A promotion and every customer's free trial ended five and a half hours away from the time the business meant, because the software kept the wrong clock.

All articles