- Situation
- Dinely is a restaurant reservation platform. Two people hitting the same table at the same second is the one failure the product cannot have.
- What I did
- The scheduling and availability rules live in the database — roughly 38k lines of PL/pgSQL — rather than in application code. A double booking is rejected by Postgres, not caught by a check in the request handler.
- What I rejected
- Enforcing it in the app layer, which is faster to write and what most of these systems do. It also can't guarantee correctness once two requests are in flight at once.
- What changed
- It held. The trade is that the logic is harder to change and harder for a new developer to pick up, which is a real cost and one I'd make again for this particular guarantee.