This commit is contained in:
2026-02-20 20:10:46 -08:00
parent 27fb986f58
commit b7a78b7bb9
29 changed files with 999 additions and 33 deletions
+20
View File
@@ -0,0 +1,20 @@
CREATE TABLE `refresh_token` (
`id_refresh_token` int NOT NULL AUTO_INCREMENT,
`id_user` int NOT NULL,
`token_hash` varchar(512) NOT NULL,
`token_salt` varchar(512) NOT NULL,
`expires_at` timestamp NOT NULL,
`last_used_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`revoked_at` timestamp NULL DEFAULT NULL,
`device_info` varchar(255) DEFAULT NULL,
`user_agent` varchar(512) DEFAULT NULL,
`replaced_by_token_id` int DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id_refresh_token`),
KEY `idx_refresh_token_user` (`id_user`),
KEY `idx_refresh_token_expires` (`expires_at`),
KEY `refresh_token_ibfk_2` (`replaced_by_token_id`),
CONSTRAINT `refresh_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
CONSTRAINT `refresh_token_ibfk_2` FOREIGN KEY (`replaced_by_token_id`) REFERENCES `refresh_token` (`id_refresh_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+1
View File
@@ -4,6 +4,7 @@ CREATE TABLE `user` (
`email` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`password_hash` varchar(255) DEFAULT NULL,
`password_salt` varchar(255) DEFAULT NULL,
`password_updated_at` timestamp NULL DEFAULT NULL,
`failed_login_attempts` int DEFAULT '0',
`locked_until` timestamp NULL DEFAULT NULL,