-- NARVA leads table — run once in phpMyAdmin / mysql cli
CREATE TABLE IF NOT EXISTS leads (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    project VARCHAR(64) NOT NULL,
    name VARCHAR(120) NOT NULL,
    mobile VARCHAR(32) NOT NULL,
    email VARCHAR(160) DEFAULT NULL,
    unit_type VARCHAR(96) DEFAULT NULL,
    utm_source VARCHAR(120) DEFAULT NULL,
    utm_medium VARCHAR(120) DEFAULT NULL,
    utm_campaign VARCHAR(120) DEFAULT NULL,
    utm_content VARCHAR(120) DEFAULT NULL,
    utm_term VARCHAR(120) DEFAULT NULL,
    ip VARCHAR(45) DEFAULT NULL,
    user_agent VARCHAR(255) DEFAULT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_project (project),
    INDEX idx_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
