github.com/gogf/gf/v2@v2.7.4/.github/workflows/apollo/sql/apolloportaldb.sql (about) 1 -- 2 -- Copyright 2022 Apollo Authors 3 -- 4 -- Licensed under the Apache License, Version 2.0 (the "License"); 5 -- you may not use this file except in compliance with the License. 6 -- You may obtain a copy of the License at 7 -- 8 -- http://www.apache.org/licenses/LICENSE-2.0 9 -- 10 -- Unless required by applicable law or agreed to in writing, software 11 -- distributed under the License is distributed on an "AS IS" BASIS, 12 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 -- See the License for the specific language governing permissions and 14 -- limitations under the License. 15 -- 16 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 /*!40101 SET NAMES utf8 */; 20 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 21 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 22 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 23 24 # Create Database 25 # ------------------------------------------------------------ 26 CREATE DATABASE IF NOT EXISTS ApolloPortalDB DEFAULT CHARACTER SET = utf8mb4; 27 28 Use ApolloPortalDB; 29 30 # Dump of table app 31 # ------------------------------------------------------------ 32 33 DROP TABLE IF EXISTS `App`; 34 35 CREATE TABLE `App` ( 36 `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', 37 `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', 38 `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', 39 `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', 40 `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', 41 `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', 42 `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', 43 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 44 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 45 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 46 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 47 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 48 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 49 PRIMARY KEY (`Id`), 50 UNIQUE KEY `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`), 51 KEY `DataChange_LastTime` (`DataChange_LastTime`), 52 KEY `IX_Name` (`Name`(191)) 53 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表'; 54 55 56 57 # Dump of table appnamespace 58 # ------------------------------------------------------------ 59 60 DROP TABLE IF EXISTS `AppNamespace`; 61 62 CREATE TABLE `AppNamespace` ( 63 `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', 64 `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', 65 `AppId` varchar(64) NOT NULL DEFAULT '' COMMENT 'app id', 66 `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', 67 `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', 68 `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释', 69 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 70 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 71 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 72 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 73 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 74 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 75 PRIMARY KEY (`Id`), 76 UNIQUE KEY `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`), 77 KEY `Name_AppId` (`Name`,`AppId`), 78 KEY `DataChange_LastTime` (`DataChange_LastTime`) 79 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义'; 80 81 82 83 # Dump of table consumer 84 # ------------------------------------------------------------ 85 86 DROP TABLE IF EXISTS `Consumer`; 87 88 CREATE TABLE `Consumer` ( 89 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 90 `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', 91 `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', 92 `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', 93 `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', 94 `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', 95 `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', 96 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 97 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 98 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 99 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 100 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 101 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 102 PRIMARY KEY (`Id`), 103 UNIQUE KEY `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`), 104 KEY `DataChange_LastTime` (`DataChange_LastTime`) 105 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放API消费者'; 106 107 108 109 # Dump of table consumeraudit 110 # ------------------------------------------------------------ 111 112 DROP TABLE IF EXISTS `ConsumerAudit`; 113 114 CREATE TABLE `ConsumerAudit` ( 115 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 116 `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id', 117 `Uri` varchar(1024) NOT NULL DEFAULT '' COMMENT '访问的Uri', 118 `Method` varchar(16) NOT NULL DEFAULT '' COMMENT '访问的Method', 119 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 120 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 121 PRIMARY KEY (`Id`), 122 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), 123 KEY `IX_ConsumerId` (`ConsumerId`) 124 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer审计表'; 125 126 127 128 # Dump of table consumerrole 129 # ------------------------------------------------------------ 130 131 DROP TABLE IF EXISTS `ConsumerRole`; 132 133 CREATE TABLE `ConsumerRole` ( 134 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 135 `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id', 136 `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', 137 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 138 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 139 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 140 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 141 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 142 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 143 PRIMARY KEY (`Id`), 144 UNIQUE KEY `UK_ConsumerId_RoleId_DeletedAt` (`ConsumerId`,`RoleId`,`DeletedAt`), 145 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), 146 KEY `IX_RoleId` (`RoleId`) 147 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer和role的绑定表'; 148 149 150 151 # Dump of table consumertoken 152 # ------------------------------------------------------------ 153 154 DROP TABLE IF EXISTS `ConsumerToken`; 155 156 CREATE TABLE `ConsumerToken` ( 157 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 158 `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId', 159 `Token` varchar(128) NOT NULL DEFAULT '' COMMENT 'token', 160 `Expires` datetime NOT NULL DEFAULT '2099-01-01 00:00:00' COMMENT 'token失效时间', 161 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 162 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 163 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 164 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 165 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 166 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 167 PRIMARY KEY (`Id`), 168 UNIQUE KEY `UK_Token_DeletedAt` (`Token`,`DeletedAt`), 169 KEY `DataChange_LastTime` (`DataChange_LastTime`) 170 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token表'; 171 172 # Dump of table favorite 173 # ------------------------------------------------------------ 174 175 DROP TABLE IF EXISTS `Favorite`; 176 177 CREATE TABLE `Favorite` ( 178 `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', 179 `UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户', 180 `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', 181 `Position` int(32) NOT NULL DEFAULT '10000' COMMENT '收藏顺序', 182 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 183 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 184 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 185 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 186 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 187 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 188 PRIMARY KEY (`Id`), 189 UNIQUE KEY `UK_UserId_AppId_DeletedAt` (`UserId`,`AppId`,`DeletedAt`), 190 KEY `AppId` (`AppId`(191)), 191 KEY `DataChange_LastTime` (`DataChange_LastTime`) 192 ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表'; 193 194 # Dump of table permission 195 # ------------------------------------------------------------ 196 197 DROP TABLE IF EXISTS `Permission`; 198 199 CREATE TABLE `Permission` ( 200 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 201 `PermissionType` varchar(32) NOT NULL DEFAULT '' COMMENT '权限类型', 202 `TargetId` varchar(256) NOT NULL DEFAULT '' COMMENT '权限对象类型', 203 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 204 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 205 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 206 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 207 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 208 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 209 PRIMARY KEY (`Id`), 210 UNIQUE KEY `UK_TargetId_PermissionType_DeletedAt` (`TargetId`,`PermissionType`,`DeletedAt`), 211 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) 212 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='permission表'; 213 214 215 216 # Dump of table role 217 # ------------------------------------------------------------ 218 219 DROP TABLE IF EXISTS `Role`; 220 221 CREATE TABLE `Role` ( 222 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 223 `RoleName` varchar(256) NOT NULL DEFAULT '' COMMENT 'Role name', 224 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 225 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 226 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 227 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 228 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 229 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 230 PRIMARY KEY (`Id`), 231 UNIQUE KEY `UK_RoleName_DeletedAt` (`RoleName`,`DeletedAt`), 232 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) 233 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; 234 235 236 237 # Dump of table rolepermission 238 # ------------------------------------------------------------ 239 240 DROP TABLE IF EXISTS `RolePermission`; 241 242 CREATE TABLE `RolePermission` ( 243 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 244 `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', 245 `PermissionId` int(10) unsigned DEFAULT NULL COMMENT 'Permission Id', 246 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 247 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 248 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 249 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 250 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 251 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 252 PRIMARY KEY (`Id`), 253 UNIQUE KEY `UK_RoleId_PermissionId_DeletedAt` (`RoleId`,`PermissionId`,`DeletedAt`), 254 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), 255 KEY `IX_PermissionId` (`PermissionId`) 256 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表'; 257 258 259 260 # Dump of table serverconfig 261 # ------------------------------------------------------------ 262 263 DROP TABLE IF EXISTS `ServerConfig`; 264 265 CREATE TABLE `ServerConfig` ( 266 `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 267 `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key', 268 `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值', 269 `Comment` varchar(1024) DEFAULT '' COMMENT '注释', 270 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 271 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 272 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 273 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 274 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 275 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 276 PRIMARY KEY (`Id`), 277 UNIQUE KEY `UK_Key_DeletedAt` (`Key`,`DeletedAt`), 278 KEY `DataChange_LastTime` (`DataChange_LastTime`) 279 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置'; 280 281 282 283 # Dump of table userrole 284 # ------------------------------------------------------------ 285 286 DROP TABLE IF EXISTS `UserRole`; 287 288 CREATE TABLE `UserRole` ( 289 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 290 `UserId` varchar(128) DEFAULT '' COMMENT '用户身份标识', 291 `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id', 292 `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', 293 `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds', 294 `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', 295 `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 296 `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀', 297 `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', 298 PRIMARY KEY (`Id`), 299 UNIQUE KEY `UK_UserId_RoleId_DeletedAt` (`UserId`,`RoleId`,`DeletedAt`), 300 KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), 301 KEY `IX_RoleId` (`RoleId`) 302 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表'; 303 304 # Dump of table Users 305 # ------------------------------------------------------------ 306 307 DROP TABLE IF EXISTS `Users`; 308 309 CREATE TABLE `Users` ( 310 `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 311 `Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户登录账户', 312 `Password` varchar(512) NOT NULL DEFAULT 'default' COMMENT '密码', 313 `UserDisplayName` varchar(512) NOT NULL DEFAULT 'default' COMMENT '用户名称', 314 `Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址', 315 `Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效', 316 PRIMARY KEY (`Id`), 317 UNIQUE KEY `UK_Username` (`Username`) 318 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; 319 320 321 # Dump of table Authorities 322 # ------------------------------------------------------------ 323 324 DROP TABLE IF EXISTS `Authorities`; 325 326 CREATE TABLE `Authorities` ( 327 `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', 328 `Username` varchar(64) NOT NULL, 329 `Authority` varchar(50) NOT NULL, 330 PRIMARY KEY (`Id`) 331 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 332 333 334 # Config 335 # ------------------------------------------------------------ 336 INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`) 337 VALUES 338 ('apollo.portal.envs', 'dev', '可支持的环境列表'), 339 ('organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]', '部门列表'), 340 ('superAdmin', 'apollo', 'Portal超级管理员'), 341 ('api.readTimeout', '10000', 'http接口read timeout'), 342 ('consumer.token.salt', 'someSalt', 'consumer token salt'), 343 ('admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace'), 344 ('configView.memberOnly.envs', 'dev', '只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔'), 345 ('apollo.portal.meta.servers', '{}', '各环境Meta Service列表'); 346 347 INSERT INTO `Users` (`Username`, `Password`, `UserDisplayName`, `Email`, `Enabled`) 348 VALUES 349 ('apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo', 'apollo@acme.com', 1); 350 351 INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user'); 352 353 # Sample Data 354 # ------------------------------------------------------------ 355 INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`) 356 VALUES 357 ('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com'); 358 359 INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`) 360 VALUES 361 ('application', 'SampleApp', 'properties', 0, 'default app namespace'); 362 363 INSERT INTO `Permission` (`Id`, `PermissionType`, `TargetId`) 364 VALUES 365 (1, 'CreateCluster', 'SampleApp'), 366 (2, 'CreateNamespace', 'SampleApp'), 367 (3, 'AssignRole', 'SampleApp'), 368 (4, 'ModifyNamespace', 'SampleApp+application'), 369 (5, 'ReleaseNamespace', 'SampleApp+application'); 370 371 INSERT INTO `Role` (`Id`, `RoleName`) 372 VALUES 373 (1, 'Master+SampleApp'), 374 (2, 'ModifyNamespace+SampleApp+application'), 375 (3, 'ReleaseNamespace+SampleApp+application'); 376 377 INSERT INTO `RolePermission` (`RoleId`, `PermissionId`) 378 VALUES 379 (1, 1), 380 (1, 2), 381 (1, 3), 382 (2, 4), 383 (3, 5); 384 385 INSERT INTO `UserRole` (`UserId`, `RoleId`) 386 VALUES 387 ('apollo', 1), 388 ('apollo', 2), 389 ('apollo', 3); 390 391 -- spring session (https://github.com/spring-projects/spring-session/blob/faee8f1bdb8822a5653a81eba838dddf224d92d6/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc/schema-mysql.sql) 392 CREATE TABLE SPRING_SESSION ( 393 PRIMARY_ID CHAR(36) NOT NULL, 394 SESSION_ID CHAR(36) NOT NULL, 395 CREATION_TIME BIGINT NOT NULL, 396 LAST_ACCESS_TIME BIGINT NOT NULL, 397 MAX_INACTIVE_INTERVAL INT NOT NULL, 398 EXPIRY_TIME BIGINT NOT NULL, 399 PRINCIPAL_NAME VARCHAR(100), 400 CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (PRIMARY_ID) 401 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; 402 403 CREATE UNIQUE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (SESSION_ID); 404 CREATE INDEX SPRING_SESSION_IX2 ON SPRING_SESSION (EXPIRY_TIME); 405 CREATE INDEX SPRING_SESSION_IX3 ON SPRING_SESSION (PRINCIPAL_NAME); 406 407 CREATE TABLE SPRING_SESSION_ATTRIBUTES ( 408 SESSION_PRIMARY_ID CHAR(36) NOT NULL, 409 ATTRIBUTE_NAME VARCHAR(200) NOT NULL, 410 ATTRIBUTE_BYTES BLOB NOT NULL, 411 CONSTRAINT SPRING_SESSION_ATTRIBUTES_PK PRIMARY KEY (SESSION_PRIMARY_ID, ATTRIBUTE_NAME), 412 CONSTRAINT SPRING_SESSION_ATTRIBUTES_FK FOREIGN KEY (SESSION_PRIMARY_ID) REFERENCES SPRING_SESSION(PRIMARY_ID) ON DELETE CASCADE 413 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; 414 415 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 416 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 417 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 418 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 419 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 420 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;