CREATE USER 'slave'@'%' IDENTIFIED BY 'aA123456!';
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';
FLUSH PRIVILEGES;
CREATE DATABASE example;
USE example;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for User
-- ----------------------------
DROP TABLE IF EXISTS `User`;
CREATE TABLE `User`  (
  `Id` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Id',
  `UserName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'UserName',
  `SecurityStamp` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'SecurityStamp',
  `PasswordHash` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'PasswordHash',
  `PasswordConfirmed` tinyint(1) NOT NULL COMMENT 'PasswordConfirmed',
  `Email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'Email',
  `EmailConfirmed` tinyint(1) NOT NULL COMMENT 'EmailConfirmed',
  `PhoneNumber` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'PhoneNumber',
  `PhoneNumberConfirmed` tinyint(1) NOT NULL COMMENT 'PhoneNumberConfirmed',
  `RealName` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'RealName',
  `IdentityNumber` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'IdentityNumber',
  `IdentityConfirmed` tinyint(1) NOT NULL COMMENT 'IdentityConfirmed',
  `NickName` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'NickName',
  `Avatar` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'Avatar',
  `Sex` int(0) NULL DEFAULT NULL COMMENT 'Sex',
  `Birthday` datetime(6) NULL DEFAULT NULL COMMENT 'Birthday',
  `LockoutEnabled` tinyint(1) NOT NULL COMMENT 'LockoutEnabled',
  `AccessFailedCount` int(0) NOT NULL COMMENT 'AccessFailedCount',
  `LockoutEnd` datetime(6) NULL DEFAULT NULL COMMENT 'LockoutEnd',
  `RowVersion` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'RowVersion',
  `Created` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT 'Created',
  `Modified` datetime(6) NULL DEFAULT NULL COMMENT 'Modified',
  `Deleted` datetime(6) NULL DEFAULT NULL COMMENT 'Deleted',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `IX_User_UserName`(`UserName`) USING BTREE,
  UNIQUE INDEX `IX_User_Email`(`Email`) USING BTREE,
  UNIQUE INDEX `IX_User_PhoneNumber`(`PhoneNumber`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of User
-- ----------------------------
INSERT INTO `User` VALUES ('49fa11e7-4404-4fe5-9873-e89a01d8e529', 'super', '123456', '579f889441b4a55d667233941d72a83ed644f7e5', 1, 'super@test.com', 1, NULL, 0, NULL, NULL, 0, '超级管理员', NULL, NULL, NULL, 0, 0, NULL, '1e59e461-af12-446f-b876-eac8f58d3c79', '2021-04-14 05:10:36.611675', NULL, NULL);
INSERT INTO `User` VALUES ('74fab867-a65a-4cda-8b2f-63e12d003b79', 'user', '123456', '71dd07494c5ee54992a27746d547e25dee01bd97', 1, 'user@test.com', 1, NULL, 0, NULL, NULL, 0, '普通用户', NULL, NULL, NULL, 0, 0, NULL, '2b691577-e96c-40fe-897e-3adc9a4488bf', '2021-04-14 05:10:36.611679', NULL, NULL);
INSERT INTO `User` VALUES ('e6a2e59c-a4e1-4ced-856c-036b6e4786d1', 'admin', '123456', '579f889441b4a55d667233941d72a83ed644f7e5', 1, 'admin@test.com', 1, NULL, 0, NULL, NULL, 0, '管理员', NULL, NULL, NULL, 0, 0, NULL, '7d53094e-569d-4689-a6d1-d2c1f99da85b', '2021-04-14 05:10:36.611663', NULL, NULL);

-- ----------------------------
-- Table structure for Role
-- ----------------------------
DROP TABLE IF EXISTS `Role`;
CREATE TABLE `Role`  (
  `Id` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Id',
  `Name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Name',
  `Number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Number',
  `IsReadOnly` tinyint(1) NOT NULL COMMENT 'IsReadOnly',
  `Created` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT 'Created',
  `Modified` datetime(6) NULL DEFAULT NULL COMMENT 'Modified',
  `Deleted` datetime(6) NULL DEFAULT NULL COMMENT 'Deleted',
  PRIMARY KEY (`Id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of Role
-- ----------------------------
INSERT INTO `Role` VALUES ('74ce76b4-c239-4ba7-938c-27a069a9e8f5', '机构管理员', 'organ', 0, '2021-04-14 05:10:25.509670', NULL, NULL);
INSERT INTO `Role` VALUES ('a7964dbe-5dbf-41c9-9906-3266f47f5746', '管理员', 'admin', 0, '2021-04-14 05:10:25.509716', NULL, NULL);
INSERT INTO `Role` VALUES ('a9784fe1-b830-46f2-b1aa-f7620a92ed4a', '超级管理员', 'super', 1, '2021-04-14 05:10:25.509719', NULL, NULL);


SET FOREIGN_KEY_CHECKS = 1;