-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
96 lines (77 loc) · 3.65 KB
/
database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`SSO` varchar(255) DEFAULT NULL,
`language` varchar(255) NOT NULL DEFAULT 'Japanese',
`email` varchar(255) NOT NULL,
`icon_path` varchar(255) DEFAULT NULL,
`public_id` varchar(255) NOT NULL,
`private_id` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`UserBatch` text NOT NULL,
`two_factor_secret` varchar(255) DEFAULT NULL,
`two_factor_enabled` tinyint(1) DEFAULT 0,
`notifications` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '\'{"security": true, "announcements": false, "status": false}\''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `users` (`id`, `username`, `name`, `password`, `SSO`, `language`, `email`, `icon_path`, `public_id`, `private_id`, `created_at`, `UserBatch`, `two_factor_secret`, `two_factor_enabled`, `notifications`) VALUES
CREATE TABLE `users_factor` (
`id` int(11) NOT NULL,
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`two_factor_secret` varchar(255) NOT NULL,
`two_factor_enabled` tinytext DEFAULT '0',
`recovery_codes` longtext DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `users_session` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`session_id` varchar(255) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`last_login_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `users_verification` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`token` varchar(255) NOT NULL,
`type` enum('email_verification','password_reset','deactivate_verification','recovery_codes_verification') NOT NULL,
`is_verified` tinyint(1) DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`expires_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `public_id` (`public_id`),
ADD UNIQUE KEY `private_id` (`private_id`);
ALTER TABLE `users_factor`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users_session`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users_verification`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=112;
ALTER TABLE `users_factor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
ALTER TABLE `users_session`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=431;
ALTER TABLE `users_verification`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=109;
ALTER TABLE `users_verification`
ADD CONSTRAINT `users_verification_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;