A daily task list that resets cleanly
Generate the day's tasks once, track progress against a date key, and pay the completion bonus exactly once — no midnight cron required.
10 entries
Generate the day's tasks once, track progress against a date key, and pay the completion bonus exactly once — no midnight cron required.
A table of conditions, a checker that runs after activity, and a unique key so an achievement can only be awarded once.
Percentage of earnings, one-off signup bonus, or a share of what you earn from the referral. The arithmetic that decides which one bankrupts you.
Every manual adjustment writes a ledger row and an audit row, inside one transaction. An admin panel that edits a balance directly is how books stop balancing.
Compute the fee once, show the net before they confirm, and keep every threshold in the settings table so repricing is not a code change.
Make the column unsigned, check inside the transaction, and let a clawback take a balance to zero rather than below it.
A caller-supplied key with a unique index turns every retry, refresh and double-click into a no-op. The single most valuable column in a payments schema.
A unique index on your own reference turns duplicate callbacks, browser refreshes and manual replays into no-ops instead of free balance.
Debit on request, not on approval. The state machine that makes double payouts and phantom balances impossible.
Lock both rows in a fixed order, check inside the transaction, and write a ledger entry for each side. Skipping any of the three is how balances drift.