apolloconfigdb.sql 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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 ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
  26. Use ApolloConfigDB;
  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 audit
  71. # ------------------------------------------------------------
  72. DROP TABLE IF EXISTS `Audit`;
  73. CREATE TABLE `Audit` (
  74. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  75. `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名',
  76. `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID',
  77. `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型',
  78. `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
  79. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  80. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  81. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  82. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  83. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  84. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  85. PRIMARY KEY (`Id`),
  86. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  87. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表';
  88. # Dump of table cluster
  89. # ------------------------------------------------------------
  90. DROP TABLE IF EXISTS `Cluster`;
  91. CREATE TABLE `Cluster` (
  92. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  93. `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字',
  94. `AppId` varchar(64) NOT NULL DEFAULT '' COMMENT 'App id',
  95. `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster',
  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_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`),
  104. KEY `IX_ParentClusterId` (`ParentClusterId`),
  105. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  106. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群';
  107. # Dump of table commit
  108. # ------------------------------------------------------------
  109. DROP TABLE IF EXISTS `Commit`;
  110. CREATE TABLE `Commit` (
  111. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  112. `ChangeSets` longtext NOT NULL COMMENT '修改变更集',
  113. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  114. `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
  115. `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
  116. `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
  117. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  118. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  119. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  120. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  121. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  122. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  123. PRIMARY KEY (`Id`),
  124. KEY `DataChange_LastTime` (`DataChange_LastTime`),
  125. KEY `AppId` (`AppId`(191)),
  126. KEY `ClusterName` (`ClusterName`(191)),
  127. KEY `NamespaceName` (`NamespaceName`(191))
  128. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
  129. # Dump of table grayreleaserule
  130. # ------------------------------------------------------------
  131. DROP TABLE IF EXISTS `GrayReleaseRule`;
  132. CREATE TABLE `GrayReleaseRule` (
  133. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  134. `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  135. `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
  136. `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
  137. `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name',
  138. `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则',
  139. `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release',
  140. `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布',
  141. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  142. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  143. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  144. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  145. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  146. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  147. PRIMARY KEY (`Id`),
  148. KEY `DataChange_LastTime` (`DataChange_LastTime`),
  149. KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`)
  150. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表';
  151. # Dump of table instance
  152. # ------------------------------------------------------------
  153. DROP TABLE IF EXISTS `Instance`;
  154. CREATE TABLE `Instance` (
  155. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  156. `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  157. `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
  158. `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name',
  159. `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip',
  160. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  161. `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  162. PRIMARY KEY (`Id`),
  163. UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`),
  164. KEY `IX_IP` (`Ip`),
  165. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
  166. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例';
  167. # Dump of table instanceconfig
  168. # ------------------------------------------------------------
  169. DROP TABLE IF EXISTS `InstanceConfig`;
  170. CREATE TABLE `InstanceConfig` (
  171. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  172. `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id',
  173. `ConfigAppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Config App Id',
  174. `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name',
  175. `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name',
  176. `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
  177. `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间',
  178. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  179. `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  180. PRIMARY KEY (`Id`),
  181. UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`),
  182. KEY `IX_ReleaseKey` (`ReleaseKey`),
  183. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
  184. KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`)
  185. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息';
  186. # Dump of table item
  187. # ------------------------------------------------------------
  188. DROP TABLE IF EXISTS `Item`;
  189. CREATE TABLE `Item` (
  190. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  191. `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
  192. `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
  193. `Value` longtext NOT NULL COMMENT '配置项值',
  194. `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
  195. `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号',
  196. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  197. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  198. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  199. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  200. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  201. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  202. PRIMARY KEY (`Id`),
  203. KEY `IX_GroupId` (`NamespaceId`),
  204. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  205. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
  206. # Dump of table namespace
  207. # ------------------------------------------------------------
  208. DROP TABLE IF EXISTS `Namespace`;
  209. CREATE TABLE `Namespace` (
  210. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  211. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  212. `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
  213. `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
  214. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  215. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  216. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  217. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  218. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  219. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  220. PRIMARY KEY (`Id`),
  221. UNIQUE KEY `UK_AppId_ClusterName_NamespaceName_DeletedAt` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191),`DeletedAt`),
  222. KEY `DataChange_LastTime` (`DataChange_LastTime`),
  223. KEY `IX_NamespaceName` (`NamespaceName`(191))
  224. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
  225. # Dump of table namespacelock
  226. # ------------------------------------------------------------
  227. DROP TABLE IF EXISTS `NamespaceLock`;
  228. CREATE TABLE `NamespaceLock` (
  229. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
  230. `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
  231. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  232. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  233. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  234. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  235. `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除',
  236. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  237. PRIMARY KEY (`Id`),
  238. UNIQUE KEY `UK_NamespaceId_DeletedAt` (`NamespaceId`,`DeletedAt`),
  239. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  240. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁';
  241. # Dump of table release
  242. # ------------------------------------------------------------
  243. DROP TABLE IF EXISTS `Release`;
  244. CREATE TABLE `Release` (
  245. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  246. `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
  247. `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字',
  248. `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明',
  249. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  250. `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
  251. `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
  252. `Configurations` longtext NOT NULL COMMENT '发布配置',
  253. `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃',
  254. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  255. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  256. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  257. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  258. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  259. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  260. PRIMARY KEY (`Id`),
  261. UNIQUE KEY `UK_ReleaseKey_DeletedAt` (`ReleaseKey`,`DeletedAt`),
  262. KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
  263. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  264. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布';
  265. # Dump of table releasehistory
  266. # ------------------------------------------------------------
  267. DROP TABLE IF EXISTS `ReleaseHistory`;
  268. CREATE TABLE `ReleaseHistory` (
  269. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  270. `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  271. `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
  272. `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
  273. `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名',
  274. `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id',
  275. `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId',
  276. `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度',
  277. `OperationContext` longtext NOT NULL COMMENT '发布上下文信息',
  278. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  279. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  280. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  281. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  282. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  283. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  284. PRIMARY KEY (`Id`),
  285. KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`),
  286. KEY `IX_ReleaseId` (`ReleaseId`),
  287. KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
  288. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
  289. # Dump of table releasemessage
  290. # ------------------------------------------------------------
  291. DROP TABLE IF EXISTS `ReleaseMessage`;
  292. CREATE TABLE `ReleaseMessage` (
  293. `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  294. `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容',
  295. `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  296. PRIMARY KEY (`Id`),
  297. KEY `DataChange_LastTime` (`DataChange_LastTime`),
  298. KEY `IX_Message` (`Message`(191))
  299. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
  300. # Dump of table serverconfig
  301. # ------------------------------------------------------------
  302. DROP TABLE IF EXISTS `ServerConfig`;
  303. CREATE TABLE `ServerConfig` (
  304. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  305. `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
  306. `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群',
  307. `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
  308. `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
  309. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  310. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  311. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  312. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  313. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  314. `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  315. PRIMARY KEY (`Id`),
  316. UNIQUE KEY `UK_Key_Cluster_DeletedAt` (`Key`,`Cluster`,`DeletedAt`),
  317. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  318. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
  319. # Dump of table accesskey
  320. # ------------------------------------------------------------
  321. DROP TABLE IF EXISTS `AccessKey`;
  322. CREATE TABLE `AccessKey` (
  323. `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  324. `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  325. `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret',
  326. `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled',
  327. `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  328. `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  329. `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  330. `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  331. `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  332. `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  333. PRIMARY KEY (`Id`),
  334. UNIQUE KEY `UK_AppId_Secret_DeletedAt` (`AppId`,`Secret`,`DeletedAt`),
  335. KEY `DataChange_LastTime` (`DataChange_LastTime`)
  336. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥';
  337. # Config
  338. # ------------------------------------------------------------
  339. INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
  340. VALUES
  341. ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
  342. ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
  343. ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
  344. ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
  345. ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
  346. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  347. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  348. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  349. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  350. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  351. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;