apolloportaldb.sql 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. # Create Database
  24. # ------------------------------------------------------------
  25. CREATE DATABASE IF NOT EXISTS ApolloPortalDB DEFAULT CHARACTER SET = utf8mb4;
  26. Use ApolloPortalDB;
  27. # Dump of table app
  28. # ------------------------------------------------------------
  29. DROP TABLE IF EXISTS `App`;
  30. CREATE TABLE `App` (
  31. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  32. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  33. `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
  34. `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
  35. `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
  36. `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
  37. `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
  38. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  39. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  40. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  41. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  42. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  43. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  44. PRIMARY KEY (`Id`),
  45. UNIQUE KEY `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`),
  46. KEY `DataChange_LastTime` (`DataChange_LastTime`),
  47. KEY `IX_Name` (`Name`(191))
  48. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
  49. # Dump of table appnamespace
  50. # ------------------------------------------------------------
  51. DROP TABLE IF EXISTS `AppNamespace`;
  52. CREATE TABLE `AppNamespace` (
  53. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  54. `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
  55. `AppId` varchar(64) NOT NULL DEFAULT '' COMMENT 'app id',
  56. `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型',
  57. `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共',
  58. `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释',
  59. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  60. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  61. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  62. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  63. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  64. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  65. PRIMARY KEY (`Id`),
  66. UNIQUE KEY `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`),
  67. KEY `Name_AppId` (`Name`,`AppId`),
  68. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  69. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
  70. # Dump of table consumer
  71. # ------------------------------------------------------------
  72. DROP TABLE IF EXISTS `Consumer`;
  73. CREATE TABLE `Consumer` (
  74. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  75. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  76. `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
  77. `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
  78. `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
  79. `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
  80. `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
  81. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  82. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  83. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  84. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  85. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  86. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  87. PRIMARY KEY (`Id`),
  88. UNIQUE KEY `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`),
  89. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  90. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放API消费者';
  91. # Dump of table consumeraudit
  92. # ------------------------------------------------------------
  93. DROP TABLE IF EXISTS `ConsumerAudit`;
  94. CREATE TABLE `ConsumerAudit` (
  95. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  96. `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
  97. `Uri` varchar(1024) NOT NULL DEFAULT '' COMMENT '访问的Uri',
  98. `Method` varchar(16) NOT NULL DEFAULT '' COMMENT '访问的Method',
  99. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  100. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  101. PRIMARY KEY (`Id`),
  102. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
  103. KEY `IX_ConsumerId` (`ConsumerId`)
  104. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer审计表';
  105. # Dump of table consumerrole
  106. # ------------------------------------------------------------
  107. DROP TABLE IF EXISTS `ConsumerRole`;
  108. CREATE TABLE `ConsumerRole` (
  109. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  110. `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
  111. `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
  112. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  113. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  114. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  115. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  116. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  117. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  118. PRIMARY KEY (`Id`),
  119. UNIQUE KEY `UK_ConsumerId_RoleId_DeletedAt` (`ConsumerId`,`RoleId`,`DeletedAt`),
  120. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
  121. KEY `IX_RoleId` (`RoleId`)
  122. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer和role的绑定表';
  123. # Dump of table consumertoken
  124. # ------------------------------------------------------------
  125. DROP TABLE IF EXISTS `ConsumerToken`;
  126. CREATE TABLE `ConsumerToken` (
  127. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  128. `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId',
  129. `Token` varchar(128) NOT NULL DEFAULT '' COMMENT 'token',
  130. `Expires` datetime NOT NULL DEFAULT '2099-01-01 00:00:00' COMMENT 'token失效时间',
  131. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  132. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  133. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  134. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  135. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  136. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  137. PRIMARY KEY (`Id`),
  138. UNIQUE KEY `UK_Token_DeletedAt` (`Token`,`DeletedAt`),
  139. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  140. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token表';
  141. # Dump of table favorite
  142. # ------------------------------------------------------------
  143. DROP TABLE IF EXISTS `Favorite`;
  144. CREATE TABLE `Favorite` (
  145. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  146. `UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户',
  147. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  148. `Position` int(32) NOT NULL DEFAULT '10000' COMMENT '收藏顺序',
  149. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  150. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  151. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  152. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  153. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  154. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  155. PRIMARY KEY (`Id`),
  156. UNIQUE KEY `UK_UserId_AppId_DeletedAt` (`UserId`,`AppId`,`DeletedAt`),
  157. KEY `AppId` (`AppId`(191)),
  158. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  159. ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表';
  160. # Dump of table permission
  161. # ------------------------------------------------------------
  162. DROP TABLE IF EXISTS `Permission`;
  163. CREATE TABLE `Permission` (
  164. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  165. `PermissionType` varchar(32) NOT NULL DEFAULT '' COMMENT '权限类型',
  166. `TargetId` varchar(256) NOT NULL DEFAULT '' COMMENT '权限对象类型',
  167. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  168. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  169. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  170. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  171. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  172. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  173. PRIMARY KEY (`Id`),
  174. UNIQUE KEY `UK_TargetId_PermissionType_DeletedAt` (`TargetId`,`PermissionType`,`DeletedAt`),
  175. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
  176. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='permission表';
  177. # Dump of table role
  178. # ------------------------------------------------------------
  179. DROP TABLE IF EXISTS `Role`;
  180. CREATE TABLE `Role` (
  181. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  182. `RoleName` varchar(256) NOT NULL DEFAULT '' COMMENT 'Role name',
  183. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  184. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  185. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  186. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  187. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  188. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  189. PRIMARY KEY (`Id`),
  190. UNIQUE KEY `UK_RoleName_DeletedAt` (`RoleName`,`DeletedAt`),
  191. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
  192. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
  193. # Dump of table rolepermission
  194. # ------------------------------------------------------------
  195. DROP TABLE IF EXISTS `RolePermission`;
  196. CREATE TABLE `RolePermission` (
  197. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  198. `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
  199. `PermissionId` int(10) unsigned DEFAULT NULL COMMENT 'Permission Id',
  200. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  201. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  202. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  203. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  204. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  205. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  206. PRIMARY KEY (`Id`),
  207. UNIQUE KEY `UK_RoleId_PermissionId_DeletedAt` (`RoleId`,`PermissionId`,`DeletedAt`),
  208. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
  209. KEY `IX_PermissionId` (`PermissionId`)
  210. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表';
  211. # Dump of table serverconfig
  212. # ------------------------------------------------------------
  213. DROP TABLE IF EXISTS `ServerConfig`;
  214. CREATE TABLE `ServerConfig` (
  215. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  216. `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
  217. `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
  218. `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
  219. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  220. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  221. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  222. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  223. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  224. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  225. PRIMARY KEY (`Id`),
  226. UNIQUE KEY `UK_Key_DeletedAt` (`Key`,`DeletedAt`),
  227. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  228. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
  229. # Dump of table userrole
  230. # ------------------------------------------------------------
  231. DROP TABLE IF EXISTS `UserRole`;
  232. CREATE TABLE `UserRole` (
  233. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  234. `UserId` varchar(128) DEFAULT '' COMMENT '用户身份标识',
  235. `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
  236. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  237. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  238. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  239. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  240. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  241. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  242. PRIMARY KEY (`Id`),
  243. UNIQUE KEY `UK_UserId_RoleId_DeletedAt` (`UserId`,`RoleId`,`DeletedAt`),
  244. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
  245. KEY `IX_RoleId` (`RoleId`)
  246. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表';
  247. # Dump of table Users
  248. # ------------------------------------------------------------
  249. DROP TABLE IF EXISTS `Users`;
  250. CREATE TABLE `Users` (
  251. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  252. `Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户登录账户',
  253. `Password` varchar(512) NOT NULL DEFAULT 'default' COMMENT '密码',
  254. `UserDisplayName` varchar(512) NOT NULL DEFAULT 'default' COMMENT '用户名称',
  255. `Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址',
  256. `Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效',
  257. PRIMARY KEY (`Id`),
  258. UNIQUE KEY `UK_Username` (`Username`)
  259. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
  260. # Dump of table Authorities
  261. # ------------------------------------------------------------
  262. DROP TABLE IF EXISTS `Authorities`;
  263. CREATE TABLE `Authorities` (
  264. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  265. `Username` varchar(64) NOT NULL,
  266. `Authority` varchar(50) NOT NULL,
  267. PRIMARY KEY (`Id`)
  268. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  269. # Config
  270. # ------------------------------------------------------------
  271. INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`)
  272. VALUES
  273. ('apollo.portal.envs', 'dev', '可支持的环境列表'),
  274. ('organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]', '部门列表'),
  275. ('superAdmin', 'apollo', 'Portal超级管理员'),
  276. ('api.readTimeout', '10000', 'http接口read timeout'),
  277. ('consumer.token.salt', 'someSalt', 'consumer token salt'),
  278. ('admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace'),
  279. ('configView.memberOnly.envs', 'pro', '只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔'),
  280. ('apollo.portal.meta.servers', '{}', '各环境Meta Service列表');
  281. INSERT INTO `Users` (`Username`, `Password`, `UserDisplayName`, `Email`, `Enabled`)
  282. VALUES
  283. ('apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo', 'apollo@acme.com', 1);
  284. INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user');
  285. -- spring session (https://github.com/spring-projects/spring-session/blob/faee8f1bdb8822a5653a81eba838dddf224d92d6/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc/schema-mysql.sql)
  286. CREATE TABLE SPRING_SESSION (
  287. PRIMARY_ID CHAR(36) NOT NULL,
  288. SESSION_ID CHAR(36) NOT NULL,
  289. CREATION_TIME BIGINT NOT NULL,
  290. LAST_ACCESS_TIME BIGINT NOT NULL,
  291. MAX_INACTIVE_INTERVAL INT NOT NULL,
  292. EXPIRY_TIME BIGINT NOT NULL,
  293. PRINCIPAL_NAME VARCHAR(100),
  294. CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (PRIMARY_ID)
  295. ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
  296. CREATE UNIQUE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (SESSION_ID);
  297. CREATE INDEX SPRING_SESSION_IX2 ON SPRING_SESSION (EXPIRY_TIME);
  298. CREATE INDEX SPRING_SESSION_IX3 ON SPRING_SESSION (PRINCIPAL_NAME);
  299. CREATE TABLE SPRING_SESSION_ATTRIBUTES (
  300. SESSION_PRIMARY_ID CHAR(36) NOT NULL,
  301. ATTRIBUTE_NAME VARCHAR(200) NOT NULL,
  302. ATTRIBUTE_BYTES BLOB NOT NULL,
  303. CONSTRAINT SPRING_SESSION_ATTRIBUTES_PK PRIMARY KEY (SESSION_PRIMARY_ID, ATTRIBUTE_NAME),
  304. CONSTRAINT SPRING_SESSION_ATTRIBUTES_FK FOREIGN KEY (SESSION_PRIMARY_ID) REFERENCES SPRING_SESSION(PRIMARY_ID) ON DELETE CASCADE
  305. ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
  306. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  307. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  308. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  309. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  310. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  311. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;