What PostgreSQL taught our billing system.
The notes about PostgreSQL from Easinvy Retail, a billing system for shops that runs on hosted Postgres. Money that is a string at rest, a daily report that grouped bills by the server's UTC day, and 160 query functions that scope every read to one shop. Each one starts from code in production.
Multi-tenancy in Drizzle, from a shipped product
Drizzle will not force a tenant filter. How a live app's 160 query functions scope by shop, and why row-level security would not have applied to it.
The shop's day is not the server's day
A report grouped by the database's UTC day counts every bill before 05:30 IST against yesterday. The query that was wrong, and the query that is right.
Decimal vs float for money, from a billing system
Money is a string at rest, a float at the counter and an integer at the gateway. Three representations in one billing system, and what happens at the seams.
Stuck on a problem like these?
Tell us where it stalled. We usually reply within one working day.