Lost updates: two sales, one counted

Two servers read the stock, both subtract one, and the shop forgets a sale. Let Postgres do the arithmetic instead, and use a version column when the app must decide.

Checking your access…