-- Links rastreáveis por contato (revr.be)
-- campaigns: flag + destino + janela de vida dos links + controle de sync
-- contacts: cliques persistidos (sobrevivem à expiração dos links no revr)
ALTER TABLE campaigns ADD COLUMN IF NOT EXISTS track_clicks boolean NOT NULL DEFAULT false;
ALTER TABLE campaigns ADD COLUMN IF NOT EXISTS track_clicks_url text;
ALTER TABLE campaigns ADD COLUMN IF NOT EXISTS link_expires_at timestamptz;
ALTER TABLE campaigns ADD COLUMN IF NOT EXISTS click_sync_at timestamptz;
ALTER TABLE contacts  ADD COLUMN IF NOT EXISTS click_count integer NOT NULL DEFAULT 0;
ALTER TABLE contacts  ADD COLUMN IF NOT EXISTS first_click_at timestamptz;
