Skip to content

Ledger schema

Migrations live in services/ledger/migrations/.

MigrationPurpose
0000-0006Foundations: shards, units, budgets, accounts, pricing, fencing
0007-0009ledger_transactions + ledger_entries + audit_outbox
0010-0011Projections + immutability triggers
0012post_ledger_transaction SP (reserve / adjustment)
0013-0015commit_estimated / provider_reported / release SPs
0016invoice_reconciled SP (dual-row audit)
0017webhook_dedupe
0019release SP v2 (TTL sweeper extensions)
0020post_denied_decision SP (Phase 3 wedge)

The SPs are the sole authority on idempotent replay, fencing CAS, lock-order canonicalization, and audit_outbox atomicity. Handlers NEVER pre-check ledger_transactions — TOCTOU guard.