-- Bulletproof consent: Gift Aid (HMRC), email opt-in, WhatsApp opt-in
-- Each consent is tracked with timestamp, exact declaration text, IP, user agent

-- Home address for HMRC Gift Aid claims
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "donorAddressLine1" TEXT;
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "donorPostcode" TEXT;

-- Gift Aid timestamp (when declaration was made)
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "giftAidAt" TIMESTAMP(3);

-- Communication consent (GDPR/PECR)
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "emailOptIn" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "whatsappOptIn" BOOLEAN NOT NULL DEFAULT false;

-- Consent audit trail (JSON blob — immutable evidence of what was shown + agreed)
ALTER TABLE "Pledge" ADD COLUMN IF NOT EXISTS "consentMeta" JSONB;
