github.com/wangyougui/gf/v2@v2.6.5/.github/workflows/apollo/sql/apolloconfigdb.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 ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
    27  
    28  Use ApolloConfigDB;
    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 audit
    84  # ------------------------------------------------------------
    85  
    86  DROP TABLE IF EXISTS `Audit`;
    87  
    88  CREATE TABLE `Audit` (
    89    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
    90    `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名',
    91    `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID',
    92    `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型',
    93    `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
    94    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
    95    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
    96    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
    97    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    98    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
    99    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   100    PRIMARY KEY (`Id`),
   101    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   102  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表';
   103  
   104  
   105  
   106  # Dump of table cluster
   107  # ------------------------------------------------------------
   108  
   109  DROP TABLE IF EXISTS `Cluster`;
   110  
   111  CREATE TABLE `Cluster` (
   112    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
   113    `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字',
   114    `AppId` varchar(64) NOT NULL DEFAULT '' COMMENT 'App id',
   115    `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster',
   116    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   117    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   118    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   119    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   120    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   121    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   122    PRIMARY KEY (`Id`),
   123    UNIQUE KEY `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`),
   124    KEY `IX_ParentClusterId` (`ParentClusterId`),
   125    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   126  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群';
   127  
   128  
   129  
   130  # Dump of table commit
   131  # ------------------------------------------------------------
   132  
   133  DROP TABLE IF EXISTS `Commit`;
   134  
   135  CREATE TABLE `Commit` (
   136    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   137    `ChangeSets` longtext NOT NULL COMMENT '修改变更集',
   138    `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   139    `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
   140    `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
   141    `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
   142    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   143    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   144    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   145    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   146    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   147    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   148    PRIMARY KEY (`Id`),
   149    KEY `DataChange_LastTime` (`DataChange_LastTime`),
   150    KEY `AppId` (`AppId`(191)),
   151    KEY `ClusterName` (`ClusterName`(191)),
   152    KEY `NamespaceName` (`NamespaceName`(191))
   153  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
   154  
   155  # Dump of table grayreleaserule
   156  # ------------------------------------------------------------
   157  
   158  DROP TABLE IF EXISTS `GrayReleaseRule`;
   159  
   160  CREATE TABLE `GrayReleaseRule` (
   161    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   162    `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   163    `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
   164    `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
   165    `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name',
   166    `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则',
   167    `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release',
   168    `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布',
   169    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   170    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   171    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   172    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   173    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   174    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   175    PRIMARY KEY (`Id`),
   176    KEY `DataChange_LastTime` (`DataChange_LastTime`),
   177    KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`)
   178  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表';
   179  
   180  
   181  # Dump of table instance
   182  # ------------------------------------------------------------
   183  
   184  DROP TABLE IF EXISTS `Instance`;
   185  
   186  CREATE TABLE `Instance` (
   187    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
   188    `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   189    `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
   190    `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name',
   191    `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip',
   192    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   193    `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   194    PRIMARY KEY (`Id`),
   195    UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`),
   196    KEY `IX_IP` (`Ip`),
   197    KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
   198  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例';
   199  
   200  
   201  
   202  # Dump of table instanceconfig
   203  # ------------------------------------------------------------
   204  
   205  DROP TABLE IF EXISTS `InstanceConfig`;
   206  
   207  CREATE TABLE `InstanceConfig` (
   208    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
   209    `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id',
   210    `ConfigAppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Config App Id',
   211    `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name',
   212    `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name',
   213    `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
   214    `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间',
   215    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   216    `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   217    PRIMARY KEY (`Id`),
   218    UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`),
   219    KEY `IX_ReleaseKey` (`ReleaseKey`),
   220    KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
   221    KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`)
   222  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息';
   223  
   224  
   225  
   226  # Dump of table item
   227  # ------------------------------------------------------------
   228  
   229  DROP TABLE IF EXISTS `Item`;
   230  
   231  CREATE TABLE `Item` (
   232    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
   233    `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
   234    `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
   235    `Value` longtext NOT NULL COMMENT '配置项值',
   236    `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
   237    `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号',
   238    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   239    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   240    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   241    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   242    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   243    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   244    PRIMARY KEY (`Id`),
   245    KEY `IX_GroupId` (`NamespaceId`),
   246    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   247  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
   248  
   249  
   250  
   251  # Dump of table namespace
   252  # ------------------------------------------------------------
   253  
   254  DROP TABLE IF EXISTS `Namespace`;
   255  
   256  CREATE TABLE `Namespace` (
   257    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
   258    `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   259    `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
   260    `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
   261    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   262    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   263    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   264    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   265    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   266    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   267    PRIMARY KEY (`Id`),
   268    UNIQUE KEY `UK_AppId_ClusterName_NamespaceName_DeletedAt` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191),`DeletedAt`),
   269    KEY `DataChange_LastTime` (`DataChange_LastTime`),
   270    KEY `IX_NamespaceName` (`NamespaceName`(191))
   271  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
   272  
   273  
   274  
   275  # Dump of table namespacelock
   276  # ------------------------------------------------------------
   277  
   278  DROP TABLE IF EXISTS `NamespaceLock`;
   279  
   280  CREATE TABLE `NamespaceLock` (
   281    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
   282    `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
   283    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   284    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   285    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   286    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   287    `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除',
   288    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   289    PRIMARY KEY (`Id`),
   290    UNIQUE KEY `UK_NamespaceId_DeletedAt` (`NamespaceId`,`DeletedAt`),
   291    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   292  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁';
   293  
   294  
   295  
   296  # Dump of table release
   297  # ------------------------------------------------------------
   298  
   299  DROP TABLE IF EXISTS `Release`;
   300  
   301  CREATE TABLE `Release` (
   302    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
   303    `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
   304    `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字',
   305    `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明',
   306    `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   307    `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
   308    `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
   309    `Configurations` longtext NOT NULL COMMENT '发布配置',
   310    `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃',
   311    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   312    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   313    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   314    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   315    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   316    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   317    PRIMARY KEY (`Id`),
   318    UNIQUE KEY `UK_ReleaseKey_DeletedAt` (`ReleaseKey`,`DeletedAt`),
   319    KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
   320    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   321  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布';
   322  
   323  
   324  # Dump of table releasehistory
   325  # ------------------------------------------------------------
   326  
   327  DROP TABLE IF EXISTS `ReleaseHistory`;
   328  
   329  CREATE TABLE `ReleaseHistory` (
   330    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
   331    `AppId` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   332    `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
   333    `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
   334    `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名',
   335    `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id',
   336    `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId',
   337    `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度',
   338    `OperationContext` longtext NOT NULL COMMENT '发布上下文信息',
   339    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   340    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   341    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   342    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   343    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   344    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   345    PRIMARY KEY (`Id`),
   346    KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`),
   347    KEY `IX_ReleaseId` (`ReleaseId`),
   348    KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
   349  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
   350  
   351  
   352  # Dump of table releasemessage
   353  # ------------------------------------------------------------
   354  
   355  DROP TABLE IF EXISTS `ReleaseMessage`;
   356  
   357  CREATE TABLE `ReleaseMessage` (
   358    `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
   359    `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容',
   360    `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   361    PRIMARY KEY (`Id`),
   362    KEY `DataChange_LastTime` (`DataChange_LastTime`),
   363    KEY `IX_Message` (`Message`(191))
   364  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
   365  
   366  
   367  
   368  # Dump of table serverconfig
   369  # ------------------------------------------------------------
   370  
   371  DROP TABLE IF EXISTS `ServerConfig`;
   372  
   373  CREATE TABLE `ServerConfig` (
   374    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
   375    `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
   376    `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群',
   377    `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
   378    `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
   379    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   380    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   381    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   382    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   383    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   384    `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   385    PRIMARY KEY (`Id`),
   386    UNIQUE KEY `UK_Key_Cluster_DeletedAt` (`Key`,`Cluster`,`DeletedAt`),
   387    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   388  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
   389  
   390  # Dump of table accesskey
   391  # ------------------------------------------------------------
   392  
   393  DROP TABLE IF EXISTS `AccessKey`;
   394  
   395  CREATE TABLE `AccessKey` (
   396    `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
   397    `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
   398    `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret',
   399    `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled',
   400    `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
   401    `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
   402    `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
   403    `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   404    `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
   405    `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   406    PRIMARY KEY (`Id`),
   407    UNIQUE KEY `UK_AppId_Secret_DeletedAt` (`AppId`,`Secret`,`DeletedAt`),
   408    KEY `DataChange_LastTime` (`DataChange_LastTime`)
   409  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥';
   410  
   411  # Config
   412  # ------------------------------------------------------------
   413  INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
   414  VALUES
   415      ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
   416      ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
   417      ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
   418      ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
   419      ('item.key.length.limit', 'default', '128', 'item key 最大长度限制');
   420  
   421  # Sample Data
   422  # ------------------------------------------------------------
   423  INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`)
   424  VALUES
   425    ('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com');
   426  
   427  INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`)
   428  VALUES
   429    ('application', 'SampleApp', 'properties', 0, 'default app namespace');
   430  
   431  INSERT INTO `Cluster` (`Name`, `AppId`)
   432  VALUES
   433    ('default', 'SampleApp');
   434  
   435  INSERT INTO `Namespace` (`Id`, `AppId`, `ClusterName`, `NamespaceName`)
   436  VALUES
   437    (1, 'SampleApp', 'default', 'application');
   438  
   439  
   440  INSERT INTO `Item` VALUES (1,1,'timeout','100','sample timeout配置',1,_binary '\0',0,'default','2022-09-28 15:43:17','','2022-09-28 15:43:17'),
   441                            (2,1,'','','',2,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   442                            (3,1,'server.address',':8000','',3,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   443                            (4,1,'server.dumpRouterMap','true','',4,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   444                            (5,1,'server.routeOverWrite','true','',5,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   445                            (6,1,'server.accessLogEnabled','true','',6,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   446                            (7,1,'server.openapiPath','/api.json','',7,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   447                            (8,1,'server.swaggerPath','/swagger','',8,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   448                            (9,1,'','','',9,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   449                            (10,1,'','','# Global logging.',10,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   450                            (11,1,'logger.level','all','',11,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55'),
   451                            (12,1,'logger.stdout','true','',12,_binary '\0',0,'apollo','2022-09-28 15:47:55','apollo','2022-09-28 15:47:55');
   452  
   453  INSERT INTO `Release` VALUES (1,'20161009155425-d3a0749c6e20bc15','20161009155424-release','Sample发布','SampleApp','default','application','{\"timeout\":\"100\"}',_binary '\0',_binary '\0',0,'default','2022-09-28 15:59:38','','2022-09-28 15:59:38'),
   454                               (2,'20220929000151-1dc5634459e19171','20220929000148-release','','SampleApp','default','application','{\"timeout\":\"100\",\"server.address\":\":8000\",\"server.dumpRouterMap\":\"true\",\"server.routeOverWrite\":\"true\",\"server.accessLogEnabled\":\"true\",\"server.openapiPath\":\"/api.json\",\"server.swaggerPath\":\"/swagger\",\"logger.level\":\"all\",\"logger.stdout\":\"true\"}',_binary '\0',_binary '\0',0,'apollo','2022-09-28 16:01:51','apollo','2022-09-28 16:01:51');
   455  
   456  INSERT INTO `ReleaseHistory` VALUES (1,'SampleApp','default','application','default',1,0,0,'{}',_binary '\0',0,'apollo','2022-09-28 15:59:38','apollo','2022-09-28 15:59:38'),
   457                                      (2,'SampleApp','default','application','default',2,1,0,'{\"isEmergencyPublish\":false}',_binary '\0',0,'apollo','2022-09-28 16:01:51','apollo','2022-09-28 16:01:51');
   458  
   459  INSERT INTO `ReleaseMessage` VALUES (1,'SampleApp+default+application','2022-09-28 15:59:38'),
   460                                      (2,'SampleApp+default+application','2022-09-28 16:01:51');
   461  
   462  /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
   463  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
   464  /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
   465  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
   466  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
   467  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;