<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `login_attempts` (
            `id`             BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `username`       VARCHAR(50) NOT NULL,
            `ip_address`     VARCHAR(45) NOT NULL,
            `user_agent`     VARCHAR(500) NULL,
            `success`        TINYINT(1) NOT NULL DEFAULT 0,
            `failure_reason` VARCHAR(200) NULL,
            `attempted_at`   TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            INDEX `idx_login_attempts_user` (`username`),
            INDEX `idx_login_attempts_ip` (`ip_address`),
            INDEX `idx_login_attempts_time` (`attempted_at`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `login_attempts`",
];