-- Migration 002: Fix password_resets.expires_at, users login tracking, login_attempts
-- Safe to run multiple times (MariaDB 10.4+ supports IF NOT EXISTS)

ALTER TABLE `password_resets` ADD COLUMN IF NOT EXISTS `expires_at` DATETIME DEFAULT NULL AFTER `token`;
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `last_login_ip` VARCHAR(45) DEFAULT NULL AFTER `last_login`;
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `last_login_ua` VARCHAR(500) DEFAULT NULL AFTER `last_login_ip`;
