-- PATCH MISSING TABLES
-- Use this AFTER importing 'infosecl_platform (28).sql'

-- 1. Beta Signups (Waitlist)
-- Used in: newsletterController.js -> signupBeta
CREATE TABLE IF NOT EXISTS beta_signups (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) NOT NULL,
    ip_address VARCHAR(45),
    user_agent TEXT,
    source VARCHAR(50) DEFAULT 'web',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY unique_email (email)
);

-- 2. Newsletter Subscribers
-- Used in: newsletterController.js -> publicSubscribe
CREATE TABLE IF NOT EXISTS newsletter_subscribers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    subscribed_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    is_active BOOLEAN DEFAULT TRUE
);
