-- Create security_logs table
CREATE TABLE IF NOT EXISTS `security_logs` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `event_type` VARCHAR(50) NOT NULL,
    `message` TEXT NOT NULL,
    `severity` VARCHAR(20) NOT NULL,
    `ip_address` VARCHAR(45) NOT NULL,
    `timestamp` DATETIME NOT NULL,
    INDEX (`event_type`),
    INDEX (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Create rate_limits table
CREATE TABLE IF NOT EXISTS `rate_limits` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `ip_address` VARCHAR(45) NOT NULL,
    `action` VARCHAR(50) NOT NULL,
    `timestamp` DATETIME NOT NULL,
    INDEX (`ip_address`, `action`, `timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
