-- 
-- B2B Response Tracking Schema
-- Skeleton Coast Safaris (Method A)
--

CREATE TABLE IF NOT EXISTS `b2b_responses` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `email` VARCHAR(255) NOT NULL,
  `action` VARCHAR(50) NOT NULL, -- 'partner' or 'unsubscribe'
  `ip_address` VARCHAR(45) DEFAULT NULL,
  `user_agent` TEXT DEFAULT NULL,
  `clicked_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Indexes for optimized querying
CREATE INDEX idx_email ON b2b_responses(email);
CREATE INDEX idx_action ON b2b_responses(action);
CREATE INDEX idx_clicked_at ON b2b_responses(clicked_at);
