-- ============================================================
-- SECURITY: Rate limiting for login attempts (Migration 003)
-- Run this after 001_core_schema.sql (and 002 if you used the demo seed).
-- ============================================================

CREATE TABLE IF NOT EXISTS login_attempts (
    id INT AUTO_INCREMENT PRIMARY KEY,
    identifier VARCHAR(150) NOT NULL,   -- email or IP address
    attempted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_identifier_time (identifier, attempted_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
