feat(payments): payments schema, currency domain and money type #215
Reference in New Issue
Block a user
Delete Branch "feature/payments-data-foundation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Payments data foundation — the substrate for the in-game currency, with nothing wired to real money yet.
What
paymentsPostgres schema + a NOLOGIN confinement role (ALL onpayments.*, nothing onbackend), in migration00010.BEFORE UPDATE/DELETEtrigger + a partial idempotency index), materialisedbalances/benefits, the catalog (atoms seeded) + products + per-method prices, a typed single-rowconfig,orders,payment_events.account_idis a plainuuidkept consistent in code — the domain stays extractable into its own database. Expand-contract and reversible.Moneyvalue type: abigintin the currency's minor units, exact viamath/big, no float ever touching an amount; a whole-unit currency (Vote/Star/chip) cannot hold a fraction.Isolation guarantee
The application connects as a superuser (which bypasses grants), so the runtime wall is an import-boundary test: only
internal/paymentsimports the payments jet code. The DB role + grants are theSET ROLE-tested stepping-stone to a real separate login/process later.Tests
SET ROLE), the append-only trigger, CHECK constraints, the idempotency index, and a forward+backward migration.Money(exact round-trip, no-float, rejects fractions for whole-unit currencies) + the import-boundary test.go build/go vet/gofmtclean,go test ./backend/..., and the full-tags=integrationsuite.Docs
PLAN.md,docs/PAYMENTS.md(+_rumirror) updated to the built model.Backend jet sync (2nd commit)
jetgen regenerates the whole
backendschema and surfaced pre-existing drift in the committed backend jet (robot_blocks,robot_friend_requests, thefeedback_messagesapp_version/browser_tzcolumns, andUseSchemagaps). Fixed here rather than deferred:jet/backendregenerated to match the migrations — additive only (nullable columns appended + two new tables), with the full build/vet/unit/integration suites green.New commits pushed, approval review dismissed automatically according to repository settings