-- Login-Historie: wer hat sich wann (erfolgreich/verweigert/fehlgeschlagen) angemeldet.
CREATE TABLE IF NOT EXISTS login_history (
    id           BIGINT AUTO_INCREMENT PRIMARY KEY,
    email        VARCHAR(255) NULL,
    display_name VARCHAR(255) NULL,
    status       ENUM('success','denied','failed') NOT NULL,
    ip_address   VARCHAR(45) NOT NULL,
    user_agent   VARCHAR(255) NULL,
    reason       VARCHAR(255) NULL,
    created_at   DATETIME NOT NULL,
    INDEX idx_login_email (email),
    INDEX idx_login_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
