-- ═══════════════════════════════════════════════════════════════════════════
-- NIS2 Agile - Migration 002: Email Log
-- ═══════════════════════════════════════════════════════════════════════════

USE nis2_agile_db;

CREATE TABLE IF NOT EXISTS email_log (
    id INT AUTO_INCREMENT PRIMARY KEY,
    recipient VARCHAR(255) NOT NULL,
    subject VARCHAR(500) NOT NULL,
    type VARCHAR(100),
    status ENUM('sent','failed') DEFAULT 'sent',
    error_message TEXT,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_recipient (recipient),
    INDEX idx_created (created_at)
) ENGINE=InnoDB;
