-- Capture push-only Neon drift: referral antifraud tracking columns.

ALTER TABLE "referrals" ADD COLUMN IF NOT EXISTS "visitor_id_referrer" text;

ALTER TABLE "referrals" ADD COLUMN IF NOT EXISTS "visitor_id_referee" text;

ALTER TABLE "referrals" ADD COLUMN IF NOT EXISTS "ip_hash_referee" text;

ALTER TABLE "referrals" ADD COLUMN IF NOT EXISTS "quarantined_at" timestamp with time zone;

ALTER TABLE "referrals" ADD COLUMN IF NOT EXISTS "clicked_at" timestamp with time zone;

ALTER TABLE "referral_settings" ADD COLUMN IF NOT EXISTS "fraud_config" jsonb DEFAULT '{}'::jsonb NOT NULL;

ALTER TABLE "referral_settings" ADD COLUMN IF NOT EXISTS "dispute_window_days" integer DEFAULT 120 NOT NULL;

ALTER TABLE "referral_settings" ADD COLUMN IF NOT EXISTS "reserve_pct" integer DEFAULT 0 NOT NULL;

ALTER TABLE "referral_settings" ADD COLUMN IF NOT EXISTS "reserve_release_days" integer DEFAULT 120 NOT NULL;