1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-01-17 04:18:16 +01:00

Add MySQL schema for new tables 'users_2fa' and 'users_otps'

This commit is contained in:
Marco 2024-04-02 18:57:57 +02:00
parent bc15776348
commit 96b72f0be9

View File

@ -23,6 +23,17 @@ CREATE TABLE IF NOT EXISTS `users` (
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `users_2fa` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`mechanism` tinyint(2) unsigned NOT NULL,
`seed` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` int(10) unsigned NOT NULL,
`expires_at` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id_mechanism` (`user_id`,`mechanism`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `users_confirmations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
@ -36,6 +47,19 @@ CREATE TABLE IF NOT EXISTS `users_confirmations` (
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `users_otps` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`mechanism` tinyint(2) unsigned NOT NULL,
`single_factor` tinyint(1) unsigned NOT NULL DEFAULT '0',
`selector` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
`token` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
`expires_at` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id_mechanism` (`user_id`,`mechanism`),
KEY `selector_user_id` (`selector`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `users_remembered` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user` int(10) unsigned NOT NULL,