-- 001_ledger_idempotency.sql
-- Add unique constraint for ledger entry idempotency
-- Prevents duplicate postings with same reference_id per ledger

ALTER TABLE ledger_entries
  ADD CONSTRAINT ledger_entries_unique_ledger_reference
  UNIQUE (ledger_id, reference_id);
