115 lines
5.8 KiB
SQL
115 lines
5.8 KiB
SQL
/*
|
|
Navicat Premium Data Transfer
|
|
|
|
Source Server : mysql57
|
|
Source Server Type : MySQL
|
|
Source Server Version : 50732
|
|
Source Host : 127.0.0.1:3306
|
|
Source Schema : zyjblogs_rbac
|
|
|
|
Target Server Type : MySQL
|
|
Target Server Version : 50732
|
|
File Encoding : 65001
|
|
|
|
Date: 17/08/2022 18:14:29
|
|
*/
|
|
|
|
SET NAMES utf8mb4;
|
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
--
|
|
-- Oauth sql -- MYSQL
|
|
--
|
|
|
|
Drop table if exists oauth_client_details;
|
|
create table oauth_client_details (
|
|
client_id VARCHAR(255) PRIMARY KEY,
|
|
resource_ids VARCHAR(255),
|
|
client_secret VARCHAR(255),
|
|
scope VARCHAR(255),
|
|
authorized_grant_types VARCHAR(255),
|
|
web_server_redirect_uri VARCHAR(255),
|
|
authorities VARCHAR(255),
|
|
access_token_validity INTEGER,
|
|
refresh_token_validity INTEGER,
|
|
additional_information TEXT,
|
|
create_time timestamp default now(),
|
|
archived tinyint(1) default '0',
|
|
trusted tinyint(1) default '0',
|
|
autoapprove VARCHAR (255) default 'false'
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
Drop table if exists oauth_access_token;
|
|
create table oauth_access_token (
|
|
create_time timestamp default now(),
|
|
token_id VARCHAR(255),
|
|
token BLOB,
|
|
authentication_id VARCHAR(255) UNIQUE,
|
|
user_name VARCHAR(255),
|
|
client_id VARCHAR(255),
|
|
authentication BLOB,
|
|
refresh_token VARCHAR(255)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
Drop table if exists oauth_refresh_token;
|
|
create table oauth_refresh_token (
|
|
create_time timestamp default now(),
|
|
token_id VARCHAR(255),
|
|
token BLOB,
|
|
authentication BLOB
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
Drop table if exists oauth_code;
|
|
create table oauth_code (
|
|
create_time timestamp default now(),
|
|
code VARCHAR(255),
|
|
authentication BLOB
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
|
|
-- Add indexes
|
|
create index token_id_index on oauth_access_token (token_id);
|
|
create index authentication_id_index on oauth_access_token (authentication_id);
|
|
create index user_name_index on oauth_access_token (user_name);
|
|
create index client_id_index on oauth_access_token (client_id);
|
|
create index refresh_token_index on oauth_access_token (refresh_token);
|
|
|
|
create index token_id_index on oauth_refresh_token (token_id);
|
|
|
|
create index code_index on oauth_code (code);
|
|
|
|
|
|
INSERT INTO zyjblogs_rbac.oauth_client_details
|
|
(client_id, resource_ids, client_secret, `scope`, authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, refresh_token_validity, additional_information, autoapprove, trusted, archived)
|
|
VALUES('zyjblogs-rbac', 'zyjblogs-rbac', '$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila', 'all', 'authorization_code,password,client_credentials,implicit,refresh_token', NULL, NULL, NULL, NULL, NULL, 'false', NULL, NULL);
|
|
|
|
-- zyjblogs_rbac.`user` definition
|
|
DROP TABLE IF EXISTS `user`;
|
|
CREATE TABLE `user` (
|
|
`id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci NOT NULL COMMENT '用户id',
|
|
`username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
|
|
`name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '昵称',
|
|
`age` int DEFAULT NULL COMMENT '用户年龄',
|
|
`avatar` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像',
|
|
`password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户密码',
|
|
`phone` int DEFAULT NULL COMMENT '用户密码',
|
|
`email` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱',
|
|
`invite_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邀请者id',
|
|
`status` int DEFAULT NULL COMMENT '用户状态 1启用 0注销',
|
|
`follow_num` int DEFAULT NULL COMMENT '关注数量',
|
|
`fans_num` int DEFAULT NULL COMMENT '粉丝数量',
|
|
`deleted` tinyint DEFAULT '0',
|
|
`description` varchar(600) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户介绍',
|
|
`create_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建用户id',
|
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
|
`update_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '更新用户id',
|
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
UNIQUE KEY `username` (`username`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
|
|
|
|
SET FOREIGN_KEY_CHECKS = 1;
|