CREATE TABLE IF NOT EXISTS `password_resets` (
  `id_reset` int NOT NULL AUTO_INCREMENT,
  `rut` varchar(32) NOT NULL,
  `token_sha` char(64) NOT NULL,
  `expires_at` datetime NOT NULL,
  `used_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id_reset`),
  KEY `idx_token_sha` (`token_sha`),
  KEY `idx_expires` (`expires_at`),
  KEY `idx_rut` (`rut`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
