-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsimpleCA.sql
111 lines (101 loc) · 5.25 KB
/
simpleCA.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
Navicat Premium Data Transfer
Source Server : SimpleCA
Source Server Type : MySQL
Source Server Version : 3306
Source Host : localhost:3306
Source Schema : simpleCA
Target Server Type : MySQL
Target Server Version : 80022
File Encoding : 65001
Date: 21/04/2021 10:26:22
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for ca_requests
-- ----------------------------
DROP TABLE IF EXISTS `ca_requests`;
CREATE TABLE `ca_requests` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`created_at` datetime NULL DEFAULT NULL COMMENT '字段创建时间',
`updated_at` datetime NULL DEFAULT NULL COMMENT '更新时间',
`deleted_at` datetime NULL DEFAULT NULL COMMENT '删除时间',
`user_id` int NOT NULL COMMENT '申请证书的用户ID',
`state` int UNSIGNED NOT NULL COMMENT '证书状态(1:待审核, 2: 审核通过, 3:审核未通过)',
`public_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公钥',
`country` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '国家',
`province` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '州市',
`locality` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地区',
`organization` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组织',
`organization_unit_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门',
`common_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
`email_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
`type` int NULL DEFAULT NULL COMMENT '证书类型 1:代码签名证书, 2:SSL 证书',
`dns_names` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '证书主体拓展名,type = 2 时有效,多个空格分割',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_ca_requests_deleted_at`(`deleted_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for certificates
-- ----------------------------
DROP TABLE IF EXISTS `certificates`;
CREATE TABLE `certificates` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`created_at` datetime NULL DEFAULT NULL,
`updated_at` datetime NULL DEFAULT NULL,
`deleted_at` datetime NULL DEFAULT NULL,
`user_id` int NOT NULL COMMENT '证书拥有者ID',
`state` int UNSIGNED NOT NULL COMMENT '状态(1 代表在使用中,2代表已撤销或过期)',
`request_id` int NOT NULL COMMENT '证书请求ID',
`expire_time` bigint NOT NULL COMMENT '过期时间戳',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_certificates_deleted_at`(`deleted_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 48 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for crls
-- ----------------------------
DROP TABLE IF EXISTS `crls`;
CREATE TABLE `crls` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`created_at` datetime NULL DEFAULT NULL,
`updated_at` datetime NULL DEFAULT NULL,
`deleted_at` datetime NULL DEFAULT NULL,
`certificate_id` int NOT NULL COMMENT '证书ID',
`input_time` bigint NOT NULL COMMENT '加入时间戳',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_crls_deleted_at`(`deleted_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '证书吊销列表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_tokens
-- ----------------------------
DROP TABLE IF EXISTS `user_tokens`;
CREATE TABLE `user_tokens` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`created_at` datetime NULL DEFAULT NULL,
`updated_at` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted_at` datetime NULL DEFAULT NULL,
`user_id` int NOT NULL,
`token` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`expire_time` bigint NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user_tokens_deleted_at`(`deleted_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 113 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`created_at` datetime NULL DEFAULT NULL,
`updated_at` datetime NULL DEFAULT NULL,
`deleted_at` datetime NULL DEFAULT NULL,
`username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`authority` int NULL DEFAULT NULL COMMENT '权限,1表示系统管理员',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username`(`username`) USING BTREE,
INDEX `idx_users_deleted_at`(`deleted_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;