railyard/apps/ledgerline/migrations/0003_source_settlement_receipts.sql
caelum0x 894359e5ff feat(railyard): per-app completion pass — money-correct settlement + crate cores
- rago: exactly-once prepaid settlement (deterministic idempotency, unique partial index + in-tx ON CONFLICT guard) — closes the double-charge risk
- mint: double-entry + reserve conservation verified (14 tests)
- ledgerline: atomic settlement outbox + partial recovery index (37 tests)
- abacus: hard per-agent budget enforcement + kill-switch (54 tests)
- vend: crash reaper / in-flight session reconciliation
- turnstile/agent-runtime/ranguard/rit/game-economy/context-passport/rithub: core advanced + tests
2026-09-07 17:17:54 +03:00

9 lines
438 B
SQL

-- Durable correlation to Relay/Mint's signed source settlement. Mint remains
-- authoritative; Ledgerline stores the exact proof used to accept the event.
ALTER TABLE margin_events
ADD COLUMN IF NOT EXISTS source_settlement_receipt TEXT;
CREATE UNIQUE INDEX IF NOT EXISTS margin_events_source_receipt_hash
ON margin_events ((source_settlement_receipt::jsonb ->> 'receipt_hash'))
WHERE source_settlement_receipt IS NOT NULL;