github.com/polarismesh/polaris@v1.17.8/store/mysql/scripts/polaris_server.sql (about)

     1  /*
     2   * Tencent is pleased to support the open source community by making Polaris available.
     3   *
     4   * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     5   *
     6   * Licensed under the BSD 3-Clause License (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at
     9   *
    10   * https://opensource.org/licenses/BSD-3-Clause
    11   *
    12   * Unless required by applicable law or agreed to in writing, software distributed
    13   * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    14   * CONDITIONS OF ANY KIND, either express or implied. See the License for the
    15   * specific language governing permissions and limitations under the License.
    16   */
    17  
    18  SET
    19      SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    20  
    21  SET
    22      time_zone = "+00:00";
    23  
    24  /*!40101 SET @OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT */
    25  ;
    26  
    27  /*!40101 SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS */
    28  ;
    29  
    30  /*!40101 SET @OLD_COLLATION_CONNECTION = @@COLLATION_CONNECTION */
    31  ;
    32  
    33  /*!40101 SET NAMES utf8mb4 */
    34  ;
    35  
    36  --
    37  -- Database: `polaris_server`
    38  --
    39  CREATE DATABASE IF NOT EXISTS `polaris_server` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
    40  
    41  USE `polaris_server`;
    42  
    43  -- --------------------------------------------------------
    44  --
    45  -- Table structure `business`
    46  --
    47  CREATE TABLE `business`
    48  (
    49      `id`    varchar(32)   NOT NULL comment 'Unique ID',
    50      `name`  varchar(64)   NOT NULL comment 'business name',
    51      `token` varchar(64)   NOT NULL comment 'Token ID of the business',
    52      `owner` varchar(1024) NOT NULL comment 'The business is responsible for Owner',
    53      `flag`  tinyint(4)    NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
    54      `ctime` timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
    55      `mtime` timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
    56      PRIMARY KEY (`id`)
    57  ) ENGINE = InnoDB;
    58  
    59  -- --------------------------------------------------------
    60  --
    61  -- Table structure `instance`
    62  --
    63  CREATE TABLE `instance`
    64  (
    65      `id`                  varchar(128) NOT NULL comment 'Unique ID',
    66      `service_id`          varchar(32)  NOT NULL comment 'Service ID',
    67      `vpc_id`              varchar(64)           DEFAULT NULL comment 'VPC ID',
    68      `host`                varchar(128) NOT NULL comment 'instance Host Information',
    69      `port`                int(11)      NOT NULL comment 'instance port information',
    70      `protocol`            varchar(32)           DEFAULT NULL comment 'Listening protocols for corresponding ports, such as TPC, UDP, GRPC, DUBBO, etc.',
    71      `version`             varchar(32)           DEFAULT NULL comment 'The version of the instance can be used for version routing',
    72      `health_status`       tinyint(4)   NOT NULL DEFAULT '1' comment 'The health status of the instance, 1 is health, 0 is unhealthy',
    73      `isolate`             tinyint(4)   NOT NULL DEFAULT '0' comment 'Example isolation status flag, 0 is not isolated, 1 is isolated',
    74      `weight`              smallint(6)  NOT NULL DEFAULT '100' comment 'The weight of the instance is mainly used for LoadBalance, default is 100',
    75      `enable_health_check` tinyint(4)   NOT NULL DEFAULT '0' comment 'Whether to open a heartbeat on an instance, check the logic, 0 is not open, 1 is open',
    76      `logic_set`           varchar(128)          DEFAULT NULL comment 'Example logic packet information',
    77      `cmdb_region`         varchar(128)          DEFAULT NULL comment 'The region information of the instance is mainly used to close the route',
    78      `cmdb_zone`           varchar(128)          DEFAULT NULL comment 'The ZONE information of the instance is mainly used to close the route.',
    79      `cmdb_idc`            varchar(128)          DEFAULT NULL comment 'The IDC information of the instance is mainly used to close the route',
    80      `priority`            tinyint(4)   NOT NULL DEFAULT '0' comment 'Example priority, currently useless',
    81      `revision`            varchar(32)  NOT NULL comment 'Instance version information',
    82      `flag`                tinyint(4)   NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
    83      `ctime`               timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
    84      `mtime`               timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
    85      PRIMARY KEY (`id`),
    86      KEY `service_id` (`service_id`),
    87      KEY `mtime` (`mtime`),
    88      KEY `host` (`host`)
    89  ) ENGINE = InnoDB;
    90  
    91  -- --------------------------------------------------------
    92  --
    93  -- Table structure `health_check`
    94  --
    95  CREATE TABLE `health_check`
    96  (
    97      `id`   varchar(128) NOT NULL comment 'Instance ID',
    98      `type` tinyint(4)   NOT NULL DEFAULT '0' comment 'Instance health check type',
    99      `ttl`  int(11)      NOT NULL comment 'TTL time jumping',
   100      PRIMARY KEY (`id`)
   101      /* CONSTRAINT `health_check_ibfk_1` FOREIGN KEY (`id`) REFERENCES `instance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE */
   102  ) ENGINE = InnoDB;
   103  
   104  -- --------------------------------------------------------
   105  --
   106  -- Table structure `instance_metadata`
   107  --
   108  CREATE TABLE `instance_metadata`
   109  (
   110      `id`     varchar(128)  NOT NULL comment 'Instance ID',
   111      `mkey`   varchar(128)  NOT NULL comment 'instance label of Key',
   112      `mvalue` varchar(4096) NOT NULL comment 'instance label Value',
   113      `ctime`  timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   114      `mtime`  timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   115      PRIMARY KEY (`id`, `mkey`),
   116      KEY `mkey` (`mkey`)
   117      /* CONSTRAINT `instance_metadata_ibfk_1` FOREIGN KEY (`id`) REFERENCES `instance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE */
   118  ) ENGINE = InnoDB;
   119  
   120  -- --------------------------------------------------------
   121  --
   122  -- Table structure `namespace`
   123  --
   124  CREATE TABLE `namespace`
   125  (
   126      `name`    varchar(64)   NOT NULL comment 'Namespace name, unique',
   127      `comment` varchar(1024)          DEFAULT NULL comment 'Description of namespace',
   128      `token`   varchar(64)   NOT NULL comment 'TOKEN named space for write operation check',
   129      `owner`   varchar(1024) NOT NULL comment 'Responsible for named space Owner',
   130      `flag`    tinyint(4)    NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   131      `ctime`   timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   132      `mtime`   timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   133      PRIMARY KEY (`name`)
   134  ) ENGINE = InnoDB;
   135  
   136  --
   137  -- Data in the conveyor `namespace`
   138  --
   139  INSERT INTO `namespace` (`name`,
   140                           `comment`,
   141                           `token`,
   142                           `owner`,
   143                           `flag`,
   144                           `ctime`,
   145                           `mtime`)
   146  VALUES ('Polaris',
   147          'Polaris-server',
   148          '2d1bfe5d12e04d54b8ee69e62494c7fd',
   149          'polaris',
   150          0,
   151          '2019-09-06 07:55:07',
   152          '2019-09-06 07:55:07'),
   153         ('default',
   154          'Default Environment',
   155          'e2e473081d3d4306b52264e49f7ce227',
   156          'polaris',
   157          0,
   158          '2021-07-27 19:37:37',
   159          '2021-07-27 19:37:37');
   160  
   161  -- --------------------------------------------------------
   162  --
   163  -- Table structure `routing_config`
   164  --
   165  CREATE TABLE `routing_config`
   166  (
   167      `id`         varchar(32) NOT NULL comment 'Routing configuration ID',
   168      `in_bounds`  text comment 'Service is routing rules',
   169      `out_bounds` text comment 'Service main routing rules',
   170      `revision`   varchar(40) NOT NULL comment 'Routing rule version',
   171      `flag`       tinyint(4)  NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   172      `ctime`      timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   173      `mtime`      timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   174      PRIMARY KEY (`id`),
   175      KEY `mtime` (`mtime`)
   176  ) ENGINE = InnoDB;
   177  
   178  -- --------------------------------------------------------
   179  --
   180  -- Table structure `ratelimit_config`
   181  --
   182  CREATE TABLE `ratelimit_config`
   183  (
   184      `id`         varchar(32)    NOT NULL comment 'ratelimit rule ID',
   185      `name`       varchar(64)    NOT NULL comment 'ratelimt rule name',
   186      `disable`     tinyint(4)    NOT NULL DEFAULT '0' comment 'ratelimit disable',
   187      `service_id` varchar(32)    NOT NULL comment 'Service ID',
   188      `method`     varchar(512)   NOT NULL comment 'ratelimit method',
   189      `labels`     text           NOT NULL comment 'Conductive flow for a specific label',
   190      `priority`   smallint(6)    NOT NULL DEFAULT '0' comment 'ratelimit rule priority',
   191      `rule`       text           NOT NULL comment 'Current limiting rules',
   192      `revision`   varchar(32)    NOT NULL comment 'Limiting version',
   193      `flag`       tinyint(4)     NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   194      `ctime`      timestamp      NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   195      `mtime`      timestamp      NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   196      `etime`      timestamp      NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'RateLimit rule enable time',
   197      PRIMARY KEY (`id`),
   198      KEY `mtime` (`mtime`),
   199      KEY `service_id` (`service_id`)
   200  ) ENGINE = InnoDB;
   201  
   202  -- --------------------------------------------------------
   203  --
   204  -- Table structure `ratelimit_revision`
   205  --
   206  CREATE TABLE `ratelimit_revision`
   207  (
   208      `service_id`    varchar(32) NOT NULL comment 'Service ID',
   209      `last_revision` varchar(40) NOT NULL comment 'The latest limited limiting rule version of the corresponding service',
   210      `mtime`         timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   211      PRIMARY KEY (`service_id`),
   212      KEY `service_id` (`service_id`),
   213      KEY `mtime` (`mtime`)
   214  ) ENGINE = InnoDB;
   215  
   216  -- --------------------------------------------------------
   217  --
   218  -- Table structure `service`
   219  --
   220  CREATE TABLE `service`
   221  (
   222      `id`           varchar(32)   NOT NULL comment 'Service ID',
   223      `name`         varchar(128)  NOT NULL comment 'Service name, only under the namespace',
   224      `namespace`    varchar(64)   NOT NULL comment 'Namespace belongs to the service',
   225      `ports`        text                   DEFAULT NULL comment 'Service will have a list of all port information of the external exposure (single process exposing multiple protocols)',
   226      `business`     varchar(64)            DEFAULT NULL comment 'Service business information',
   227      `department`   varchar(1024)          DEFAULT NULL comment 'Service department information',
   228      `cmdb_mod1`    varchar(1024)          DEFAULT NULL comment '',
   229      `cmdb_mod2`    varchar(1024)          DEFAULT NULL comment '',
   230      `cmdb_mod3`    varchar(1024)          DEFAULT NULL comment '',
   231      `comment`      varchar(1024)          DEFAULT NULL comment 'Description information',
   232      `token`        varchar(2048) NOT NULL comment 'Service token, used to handle all the services involved in the service',
   233      `revision`     varchar(32)   NOT NULL comment 'Service version information',
   234      `owner`        varchar(1024) NOT NULL comment 'Owner information belonging to the service',
   235      `flag`         tinyint(4)    NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   236      `reference`    varchar(32)            DEFAULT NULL comment 'Service alias, what is the actual service name that the service is actually pointed out?',
   237      `refer_filter` varchar(1024)          DEFAULT NULL comment '',
   238      `platform_id`  varchar(32)            DEFAULT '' comment 'The platform ID to which the service belongs',
   239      `ctime`        timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   240      `mtime`        timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   241      PRIMARY KEY (`id`),
   242      UNIQUE KEY `name` (`name`, `namespace`),
   243      KEY `namespace` (`namespace`),
   244      KEY `mtime` (`mtime`),
   245      KEY `reference` (`reference`),
   246      KEY `platform_id` (`platform_id`)
   247  ) ENGINE = InnoDB;
   248  
   249  -- --------------------------------------------------------
   250  --
   251  -- Data in the conveyor `service`
   252  --
   253  INSERT INTO `service` (`id`,
   254                         `name`,
   255                         `namespace`,
   256                         `comment`,
   257                         `business`,
   258                         `token`,
   259                         `revision`,
   260                         `owner`,
   261                         `flag`,
   262                         `ctime`,
   263                         `mtime`)
   264  VALUES ('fbca9bfa04ae4ead86e1ecf5811e32a9',
   265          'polaris.checker',
   266          'Polaris',
   267          'polaris checker service',
   268          'polaris',
   269          '7d19c46de327408d8709ee7392b7700b',
   270          '301b1e9f0bbd47a6b697e26e99dfe012',
   271          'polaris',
   272          0,
   273          '2021-09-06 07:55:07',
   274          '2021-09-06 07:55:09');
   275  
   276  -- --------------------------------------------------------
   277  --
   278  -- Table structure `service_metadata`
   279  --
   280  CREATE TABLE `service_metadata`
   281  (
   282      `id`     varchar(32)   NOT NULL comment 'Service ID',
   283      `mkey`   varchar(128)  NOT NULL comment 'Service label key',
   284      `mvalue` varchar(4096) NOT NULL comment 'Service label Value',
   285      `ctime`  timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   286      `mtime`  timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   287      PRIMARY KEY (`id`, `mkey`),
   288      KEY `mkey` (`mkey`)
   289      /* CONSTRAINT `service_metadata_ibfk_1` FOREIGN KEY (`id`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE */
   290  ) ENGINE = InnoDB;
   291  
   292  -- --------------------------------------------------------
   293  --
   294  -- Table structure `owner_service_map`Quickly query all services under an Owner
   295  --
   296  CREATE TABLE `owner_service_map`
   297  (
   298      `id`        varchar(32)  NOT NULL comment '',
   299      `owner`     varchar(32)  NOT NULL comment 'Service Owner',
   300      `service`   varchar(128) NOT NULL comment 'service name',
   301      `namespace` varchar(64)  NOT NULL comment 'namespace name',
   302      PRIMARY KEY (`id`),
   303      KEY `owner` (`owner`),
   304      KEY `name` (`service`, `namespace`)
   305  ) ENGINE = InnoDB;
   306  
   307  -- --------------------------------------------------------
   308  --
   309  -- Table structure `circuitbreaker_rule`
   310  --
   311  CREATE TABLE `circuitbreaker_rule`
   312  (
   313      `id`         varchar(97)   NOT NULL comment 'Melting rule ID',
   314      `version`    varchar(32)   NOT NULL DEFAULT 'master' comment 'Melting rule version, default is MASTR',
   315      `name`       varchar(128)  NOT NULL comment 'Melting rule name',
   316      `namespace`  varchar(64)   NOT NULL comment 'Melting rule belongs to name space',
   317      `business`   varchar(64)            DEFAULT NULL comment 'Business information of fuse regular',
   318      `department` varchar(1024)          DEFAULT NULL comment 'Department information to which the fuse regular belongs',
   319      `comment`    varchar(1024)          DEFAULT NULL comment 'Description of the fuse rule',
   320      `inbounds`   text          NOT NULL comment 'Service-tuned fuse rule',
   321      `outbounds`  text          NOT NULL comment 'Service Motoring Fuse Rule',
   322      `token`      varchar(32)   NOT NULL comment 'Token, which is fucking, mainly for writing operation check',
   323      `owner`      varchar(1024) NOT NULL comment 'Melting rule Owner information',
   324      `revision`   varchar(32)   NOT NULL comment 'Melt rule version information',
   325      `flag`       tinyint(4)    NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   326      `ctime`      timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   327      `mtime`      timestamp     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   328      PRIMARY KEY (`id`, `version`),
   329      UNIQUE KEY `name` (`name`, `namespace`, `version`),
   330      KEY `mtime` (`mtime`)
   331  ) ENGINE = InnoDB;
   332  
   333  -- --------------------------------------------------------
   334  --
   335  -- Table structure `circuitbreaker_rule_relation`
   336  --
   337  CREATE TABLE `circuitbreaker_rule_relation`
   338  (
   339      `service_id`   varchar(32) NOT NULL comment 'Service ID',
   340      `rule_id`      varchar(97) NOT NULL comment 'Melting rule ID',
   341      `rule_version` varchar(32) NOT NULL comment 'Melting rule version',
   342      `flag`         tinyint(4)  NOT NULL DEFAULT '0' comment 'Logic delete flag, 0 means visible, 1 means that it has been logically deleted',
   343      `ctime`        timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   344      `mtime`        timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   345      PRIMARY KEY (`service_id`),
   346      KEY `mtime` (`mtime`),
   347      KEY `rule_id` (`rule_id`)
   348      /* CONSTRAINT `circuitbreaker_rule_relation_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE */
   349  ) ENGINE = InnoDB;
   350  
   351  -- --------------------------------------------------------
   352  --
   353  -- Table structure `t_ip_config`
   354  --
   355  CREATE TABLE `t_ip_config`
   356  (
   357      `Fip`     int(10) unsigned NOT NULL comment 'Machine IP',
   358      `FareaId` int(10) unsigned NOT NULL comment 'Area number',
   359      `FcityId` int(10) unsigned NOT NULL comment 'City number',
   360      `FidcId`  int(10) unsigned NOT NULL comment 'IDC number',
   361      `Fflag`   tinyint(4) DEFAULT '0',
   362      `Fstamp`  datetime         NOT NULL,
   363      `Fflow`   int(10) unsigned NOT NULL,
   364      PRIMARY KEY (`Fip`),
   365      KEY `idx_Fflow` (`Fflow`)
   366  ) ENGINE = InnoDB;
   367  
   368  -- --------------------------------------------------------
   369  --
   370  -- Table structure `t_policy`
   371  --
   372  CREATE TABLE `t_policy`
   373  (
   374      `FmodId` int(10) unsigned NOT NULL,
   375      `Fdiv`   int(10) unsigned NOT NULL,
   376      `Fmod`   int(10) unsigned NOT NULL,
   377      `Fflag`  tinyint(4) DEFAULT '0',
   378      `Fstamp` datetime         NOT NULL,
   379      `Fflow`  int(10) unsigned NOT NULL,
   380      PRIMARY KEY (`FmodId`)
   381  ) ENGINE = InnoDB;
   382  
   383  -- --------------------------------------------------------
   384  --
   385  -- Table structure `t_route`
   386  --
   387  CREATE TABLE `t_route`
   388  (
   389      `Fip`    int(10) unsigned NOT NULL,
   390      `FmodId` int(10) unsigned NOT NULL,
   391      `FcmdId` int(10) unsigned NOT NULL,
   392      `FsetId` varchar(32)      NOT NULL,
   393      `Fflag`  tinyint(4) DEFAULT '0',
   394      `Fstamp` datetime         NOT NULL,
   395      `Fflow`  int(10) unsigned NOT NULL,
   396      PRIMARY KEY (`Fip`, `FmodId`, `FcmdId`),
   397      KEY `Fflow` (`Fflow`),
   398      KEY `idx1` (`FmodId`, `FcmdId`, `FsetId`)
   399  ) ENGINE = InnoDB;
   400  
   401  -- --------------------------------------------------------
   402  --
   403  -- Table structure `t_section`
   404  --
   405  CREATE TABLE `t_section`
   406  (
   407      `FmodId` int(10) unsigned NOT NULL,
   408      `Ffrom`  int(10) unsigned NOT NULL,
   409      `Fto`    int(10) unsigned NOT NULL,
   410      `Fxid`   int(10) unsigned NOT NULL,
   411      `Fflag`  tinyint(4) DEFAULT '0',
   412      `Fstamp` datetime         NOT NULL,
   413      `Fflow`  int(10) unsigned NOT NULL,
   414      PRIMARY KEY (`FmodId`, `Ffrom`, `Fto`)
   415  ) ENGINE = InnoDB;
   416  
   417  -- --------------------------------------------------------
   418  --
   419  -- Table structure `start_lock`
   420  --
   421  CREATE TABLE `start_lock`
   422  (
   423      `lock_id`  int(11)     NOT NULL COMMENT '锁序号',
   424      `lock_key` varchar(32) NOT NULL COMMENT 'Lock name',
   425      `server`   varchar(32) NOT NULL COMMENT 'SERVER holding launch lock',
   426      `mtime`    timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
   427      PRIMARY KEY (`lock_id`, `lock_key`)
   428  ) ENGINE = InnoDB;
   429  
   430  --
   431  -- Data in the conveyor `start_lock`
   432  --
   433  INSERT INTO `start_lock` (`lock_id`, `lock_key`, `server`, `mtime`)
   434  VALUES (1, 'sz', 'aaa', '2019-12-05 08:35:49');
   435  
   436  -- --------------------------------------------------------
   437  --
   438  -- Table structure `cl5_module`
   439  --
   440  CREATE TABLE `cl5_module`
   441  (
   442      `module_id`    int(11)   NOT NULL COMMENT 'Module ID',
   443      `interface_id` int(11)   NOT NULL COMMENT 'Interface ID',
   444      `range_num`    int(11)   NOT NULL,
   445      `mtime`        timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   446      PRIMARY KEY (`module_id`)
   447  ) ENGINE = InnoDB COMMENT = 'To generate SID';
   448  
   449  --
   450  -- Data in the conveyor `cl5_module`
   451  --
   452  insert into cl5_module(module_id, interface_id, range_num) values (3000001, 1, 0);
   453  
   454  
   455  -- --------------------------------------------------------
   456  --
   457  -- Table structure `config_file`
   458  --
   459  CREATE TABLE `config_file`
   460  (
   461      `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   462      `namespace`   varchar(64)     NOT NULL COMMENT '所属的namespace',
   463      `group`       varchar(128)    NOT NULL DEFAULT '' COMMENT '所属的文件组',
   464      `name`        varchar(128)    NOT NULL COMMENT '配置文件名',
   465      `content`     longtext        NOT NULL COMMENT '文件内容',
   466      `format`      varchar(16)              DEFAULT 'text' COMMENT '文件格式,枚举值',
   467      `comment`     varchar(512)             DEFAULT NULL COMMENT '备注信息',
   468      `flag`        tinyint(4)      NOT NULL DEFAULT '0' COMMENT '软删除标记位',
   469      `create_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   470      `create_by`   varchar(32)              DEFAULT NULL COMMENT '创建人',
   471      `modify_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   472      `modify_by`   varchar(32)              DEFAULT NULL COMMENT '最后更新人',
   473      PRIMARY KEY (`id`),
   474      UNIQUE KEY `uk_file` (`namespace`, `group`, `name`)
   475  ) ENGINE = InnoDB
   476    AUTO_INCREMENT = 1 COMMENT = '配置文件表';
   477  
   478  -- --------------------------------------------------------
   479  --
   480  -- Table structure `config_file_group`
   481  --
   482  CREATE TABLE `config_file_group`
   483  (
   484      `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   485      `name`        varchar(128)    NOT NULL COMMENT '配置文件分组名',
   486      `namespace`   varchar(64)     NOT NULL COMMENT '所属的namespace',
   487      `comment`     varchar(512)             DEFAULT NULL COMMENT '备注信息',
   488      `owner`       varchar(1024)            DEFAULT NULL COMMENT '负责人',
   489      `create_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   490      `create_by`   varchar(32)              DEFAULT NULL COMMENT '创建人',
   491      `modify_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   492      `modify_by`   varchar(32)              DEFAULT NULL COMMENT '最后更新人',
   493      `business`     varchar(64)            DEFAULT NULL comment 'Service business information',
   494      `department`   varchar(1024)          DEFAULT NULL comment 'Service department information',
   495      `metadata` text             COMMENT '配置分组标签',
   496      `flag`        tinyint(4)      NOT NULL DEFAULT '0' COMMENT '是否被删除',
   497      PRIMARY KEY (`id`),
   498      UNIQUE KEY `uk_name` (`namespace`, `name`)
   499  ) ENGINE = InnoDB
   500    AUTO_INCREMENT = 1 COMMENT = '配置文件组表';
   501  
   502  -- --------------------------------------------------------
   503  --
   504  -- Table structure `config_file_release`
   505  --
   506  CREATE TABLE `config_file_release`
   507  (
   508      `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   509      `name`        varchar(128)             DEFAULT NULL COMMENT '发布标题',
   510      `namespace`   varchar(64)     NOT NULL COMMENT '所属的namespace',
   511      `group`       varchar(128)    NOT NULL COMMENT '所属的文件组',
   512      `file_name`   varchar(128)    NOT NULL COMMENT '配置文件名',
   513      `format`      varchar(16)              DEFAULT 'text' COMMENT '文件格式,枚举值',
   514      `content`     longtext        NOT NULL COMMENT '文件内容',
   515      `comment`     varchar(512)             DEFAULT NULL COMMENT '备注信息',
   516      `md5`         varchar(128)    NOT NULL COMMENT 'content的md5值',
   517      `version`     bigint(11)         NOT NULL COMMENT '版本号,每次发布自增1',
   518      `flag`        tinyint(4)      NOT NULL DEFAULT '0' COMMENT '是否被删除',
   519      `create_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   520      `create_by`   varchar(32)              DEFAULT NULL COMMENT '创建人',
   521      `modify_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   522      `modify_by`   varchar(32)              DEFAULT NULL COMMENT '最后更新人',
   523      `tags`        text             COMMENT '文件标签',
   524      `active`      tinyint(4)      NOT NULL DEFAULT '0' COMMENT '是否处于使用中',
   525      `description`  varchar(512)             DEFAULT NULL COMMENT '发布描述',
   526      PRIMARY KEY (`id`),
   527      UNIQUE KEY `uk_file` (`namespace`, `group`, `file_name`, `name`),
   528      KEY `idx_modify_time` (`modify_time`)
   529  ) ENGINE = InnoDB
   530    AUTO_INCREMENT = 1 COMMENT = '配置文件发布表';
   531  
   532  -- --------------------------------------------------------
   533  --
   534  -- Table structure `config_file_release_history`
   535  --
   536  CREATE TABLE `config_file_release_history`
   537  (
   538      `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   539      `name`        varchar(64)              DEFAULT '' COMMENT '发布名称',
   540      `namespace`   varchar(64)     NOT NULL COMMENT '所属的namespace',
   541      `group`       varchar(128)    NOT NULL COMMENT '所属的文件组',
   542      `file_name`   varchar(128)    NOT NULL COMMENT '配置文件名',
   543      `content`     longtext        NOT NULL COMMENT '文件内容',
   544      `format`      varchar(16)              DEFAULT 'text' COMMENT '文件格式',
   545      `comment`     varchar(512)             DEFAULT NULL COMMENT '备注信息',
   546      `md5`         varchar(128)    NOT NULL COMMENT 'content的md5值',
   547      `type`        varchar(32)     NOT NULL COMMENT '发布类型,例如全量发布、灰度发布',
   548      `status`      varchar(16)     NOT NULL DEFAULT 'success' COMMENT '发布状态,success表示成功,fail 表示失败',
   549      `create_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   550      `create_by`   varchar(32)              DEFAULT NULL COMMENT '创建人',
   551      `modify_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   552      `modify_by`   varchar(32)              DEFAULT NULL COMMENT '最后更新人',
   553      `tags`        text             COMMENT '文件标签',
   554      `version`     bigint(11)        COMMENT '版本号,每次发布自增1',
   555      `reason`      varchar(3000)             DEFAULT '' COMMENT '原因',
   556      `description`  varchar(512)             DEFAULT NULL COMMENT '发布描述',
   557      PRIMARY KEY (`id`),
   558      KEY `idx_file` (`namespace`, `group`, `file_name`)
   559  ) ENGINE = InnoDB
   560    AUTO_INCREMENT = 1 COMMENT = '配置文件发布历史表';
   561  
   562  -- --------------------------------------------------------
   563  --
   564  -- Table structure `config_file_tag`
   565  --
   566  CREATE TABLE `config_file_tag`
   567  (
   568      `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   569      `key`         varchar(128)    NOT NULL COMMENT 'tag 的键',
   570      `Value`       varchar(128)    NOT NULL COMMENT 'tag 的值',
   571      `namespace`   varchar(64)     NOT NULL COMMENT '所属的namespace',
   572      `group`       varchar(128)    NOT NULL DEFAULT '' COMMENT '所属的文件组',
   573      `file_name`   varchar(128)    NOT NULL COMMENT '配置文件名',
   574      `create_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   575      `create_by`   varchar(32)              DEFAULT NULL COMMENT '创建人',
   576      `modify_time` timestamp       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   577      `modify_by`   varchar(32)              DEFAULT NULL COMMENT '最后更新人',
   578      PRIMARY KEY (`id`),
   579      UNIQUE KEY `uk_tag` (
   580                           `key`,
   581                           `Value`,
   582                           `namespace`,
   583                           `group`,
   584                           `file_name`
   585          ),
   586      KEY `idx_file` (`namespace`, `group`, `file_name`)
   587  ) ENGINE = InnoDB COMMENT = '配置文件标签表';
   588  
   589  /*!40101 SET CHARACTER_SET_CLIENT = @OLD_CHARACTER_SET_CLIENT */
   590  ;
   591  
   592  /*!40101 SET CHARACTER_SET_RESULTS = @OLD_CHARACTER_SET_RESULTS */
   593  ;
   594  
   595  /*!40101 SET COLLATION_CONNECTION = @OLD_COLLATION_CONNECTION */
   596  ;
   597  
   598  CREATE TABLE `user`
   599  (
   600      `id`           VARCHAR(128) NOT NULL comment 'User ID',
   601      `name`         VARCHAR(100) NOT NULL comment 'user name',
   602      `password`     VARCHAR(100) NOT NULL comment 'user password',
   603      `owner`        VARCHAR(128) NOT NULL comment 'Main account ID',
   604      `source`       VARCHAR(32)  NOT NULL comment 'Account source',
   605      `mobile`       VARCHAR(12)  NOT NULL DEFAULT '' comment 'Account mobile phone number',
   606      `email`        VARCHAR(64)  NOT NULL DEFAULT '' comment 'Account mailbox',
   607      `token`        VARCHAR(255) NOT NULL comment 'The token information owned by the account can be used for SDK access authentication',
   608      `token_enable` tinyint(4)   NOT NULL DEFAULT 1,
   609      `user_type`    int          NOT NULL DEFAULT 20 comment 'Account type, 0 is the admin super account, 20 is the primary account, 50 for the child account',
   610      `comment`      VARCHAR(255) NOT NULL comment 'describe',
   611      `flag`         tinyint(4)   NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
   612      `ctime`        timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   613      `mtime`        timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   614      PRIMARY KEY (`id`),
   615      UNIQUE KEY (`name`, `owner`),
   616      KEY `owner` (`owner`),
   617      KEY `mtime` (`mtime`)
   618  ) ENGINE = InnoDB;
   619  
   620  CREATE TABLE `user_group`
   621  (
   622      `id`           VARCHAR(128) NOT NULL comment 'User group ID',
   623      `name`         VARCHAR(100) NOT NULL comment 'User group name',
   624      `owner`        VARCHAR(128) NOT NULL comment 'The main account ID of the user group',
   625      `token`        VARCHAR(255) NOT NULL comment 'TOKEN information of this user group',
   626      `comment`      VARCHAR(255) NOT NULL comment 'Description',
   627      `token_enable` tinyint(4)   NOT NULL DEFAULT 1,
   628      `flag`         tinyint(4)   NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
   629      `ctime`        timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   630      `mtime`        timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   631      PRIMARY KEY (`id`),
   632      UNIQUE KEY (`name`, `owner`),
   633      KEY `owner` (`owner`),
   634      KEY `mtime` (`mtime`)
   635  ) ENGINE = InnoDB;
   636  
   637  CREATE TABLE `user_group_relation`
   638  (
   639      `user_id`  VARCHAR(128) NOT NULL comment 'User ID',
   640      `group_id` VARCHAR(128) NOT NULL comment 'User group ID',
   641      `ctime`    timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   642      `mtime`    timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   643      PRIMARY KEY (`user_id`, `group_id`),
   644      KEY `mtime` (`mtime`)
   645  ) ENGINE = InnoDB;
   646  
   647  CREATE TABLE `auth_strategy`
   648  (
   649      `id`       VARCHAR(128) NOT NULL comment 'Strategy ID',
   650      `name`     VARCHAR(100) NOT NULL comment 'Policy name',
   651      `action`   VARCHAR(32)  NOT NULL comment 'Read and write permission for this policy, only_read = 0, read_write = 1',
   652      `owner`    VARCHAR(128) NOT NULL comment 'The account ID to which this policy is',
   653      `comment`  VARCHAR(255) NOT NULL comment 'describe',
   654      `default`  tinyint(4)   NOT NULL DEFAULT '0',
   655      `revision` VARCHAR(128) NOT NULL comment 'Authentication rule version',
   656      `flag`     tinyint(4)   NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
   657      `ctime`    timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   658      `mtime`    timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   659      PRIMARY KEY (`id`),
   660      UNIQUE KEY (`name`, `owner`),
   661      KEY `owner` (`owner`),
   662      KEY `mtime` (`mtime`)
   663  ) ENGINE = InnoDB;
   664  
   665  CREATE TABLE `auth_principal`
   666  (
   667      `strategy_id`    VARCHAR(128) NOT NULL comment 'Strategy ID',
   668      `principal_id`   VARCHAR(128) NOT NULL comment 'Principal ID',
   669      `principal_role` int          NOT NULL comment 'PRINCIPAL type, 1 is User, 2 is Group',
   670      PRIMARY KEY (`strategy_id`, `principal_id`, `principal_role`)
   671  ) ENGINE = InnoDB;
   672  
   673  CREATE TABLE `auth_strategy_resource`
   674  (
   675      `strategy_id` VARCHAR(128) NOT NULL comment 'Strategy ID',
   676      `res_type`    int          NOT NULL comment 'Resource Type, Namespaces = 0, Service = 1, configgroups = 2',
   677      `res_id`      VARCHAR(128) NOT NULL comment 'Resource ID',
   678      `ctime`       timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
   679      `mtime`       timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
   680      PRIMARY KEY (`strategy_id`, `res_type`, `res_id`),
   681      KEY `mtime` (`mtime`)
   682  ) ENGINE = InnoDB;
   683  
   684  -- Create a default master account, password is Polarismesh @ 2021
   685  INSERT INTO `user` (`id`,
   686                      `name`,
   687                      `password`,
   688                      `source`,
   689                      `token`,
   690                      `token_enable`,
   691                      `user_type`,
   692                      `comment`,
   693                      `mobile`,
   694                      `email`,
   695                      `owner`)
   696  VALUES ('65e4789a6d5b49669adf1e9e8387549c',
   697          'polaris',
   698          '$2a$10$3izWuZtE5SBdAtSZci.gs.iZ2pAn9I8hEqYrC6gwJp1dyjqQnrrum',
   699          'Polaris',
   700          'nu/0WRA4EqSR1FagrjRj0fZwPXuGlMpX+zCuWu4uMqy8xr1vRjisSbA25aAC3mtU8MeeRsKhQiDAynUR09I=',
   701          1,
   702          20,
   703          'default polaris admin account',
   704          '12345678910',
   705                  '12345678910',
   706          '');
   707  
   708  -- Permissions policy inserted into Polaris-Admin
   709  INSERT INTO `auth_strategy`(`id`,
   710                              `name`,
   711                              `action`,
   712                              `owner`,
   713                              `comment`,
   714                              `default`,
   715                              `revision`,
   716                              `flag`,
   717                              `ctime`,
   718                              `mtime`)
   719  VALUES ('fbca9bfa04ae4ead86e1ecf5811e32a9',
   720          '(用户) polaris的默认策略',
   721          'READ_WRITE',
   722          '65e4789a6d5b49669adf1e9e8387549c',
   723          'default admin',
   724          1,
   725          'fbca9bfa04ae4ead86e1ecf5811e32a9',
   726          0,
   727          sysdate(),
   728          sysdate());
   729  
   730  -- Sport rules inserted into Polaris-Admin to access
   731  INSERT INTO `auth_strategy_resource`(`strategy_id`,
   732                                       `res_type`,
   733                                       `res_id`,
   734                                       `ctime`,
   735                                       `mtime`)
   736  VALUES ('fbca9bfa04ae4ead86e1ecf5811e32a9',
   737          0,
   738          '*',
   739          sysdate(),
   740          sysdate()),
   741         ('fbca9bfa04ae4ead86e1ecf5811e32a9',
   742          1,
   743          '*',
   744          sysdate(),
   745          sysdate()),
   746         ('fbca9bfa04ae4ead86e1ecf5811e32a9',
   747          2,
   748          '*',
   749          sysdate(),
   750          sysdate());
   751  
   752  -- Insert permission policies and association relationships for Polaris-Admin accounts
   753  INSERT INTO auth_principal(`strategy_id`, `principal_id`, `principal_role`) VALUE (
   754                                                                                     'fbca9bfa04ae4ead86e1ecf5811e32a9',
   755                                                                                     '65e4789a6d5b49669adf1e9e8387549c',
   756                                                                                     1
   757      );
   758  
   759  -- v1.8.0, support client info storage
   760  CREATE TABLE `client`
   761  (
   762      `id`      VARCHAR(128) NOT NULL comment 'client id',
   763      `host`    VARCHAR(100) NOT NULL comment 'client host IP',
   764      `type`    VARCHAR(100) NOT NULL comment 'client type: polaris-java/polaris-go',
   765      `version` VARCHAR(32)  NOT NULL comment 'client SDK version',
   766      `region`  varchar(128)          DEFAULT NULL comment 'region info for client',
   767      `zone`    varchar(128)          DEFAULT NULL comment 'zone info for client',
   768      `campus`  varchar(128)          DEFAULT NULL comment 'campus info for client',
   769      `flag`    tinyint(4)   NOT NULL DEFAULT '0' COMMENT '0 is valid, 1 is invalid(deleted)',
   770      `ctime`   timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'create time',
   771      `mtime`   timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'last updated time',
   772      PRIMARY KEY (`id`),
   773      KEY `mtime` (`mtime`)
   774  ) ENGINE = InnoDB;
   775  
   776  CREATE TABLE `client_stat`
   777  (
   778      `client_id` VARCHAR(128) NOT NULL comment 'client id',
   779      `target`    VARCHAR(100) NOT NULL comment 'target stat platform',
   780      `port`      int(11)      NOT NULL comment 'client port to get stat information',
   781      `protocol`  VARCHAR(100) NOT NULL comment 'stat info transport protocol',
   782      `path`      VARCHAR(128) NOT NULL comment 'stat metric path',
   783      PRIMARY KEY (`client_id`, `target`, `port`)
   784  ) ENGINE = InnoDB;
   785  
   786  -- v1.9.0
   787  CREATE TABLE `config_file_template` (
   788      `id` bigint(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
   789      `name` varchar(128) COLLATE utf8_bin NOT NULL COMMENT '配置文件模板名称',
   790      `content` longtext COLLATE utf8_bin NOT NULL COMMENT '配置文件模板内容',
   791      `format` varchar(16) COLLATE utf8_bin DEFAULT 'text' COMMENT '模板文件格式',
   792      `comment` varchar(512) COLLATE utf8_bin DEFAULT NULL COMMENT '模板描述信息',
   793      `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   794      `create_by` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '创建人',
   795      `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
   796      `modify_by` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT '最后更新人',
   797      PRIMARY KEY (`id`),
   798      UNIQUE KEY `uk_name` (`name`)
   799  ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='配置文件模板表';
   800  
   801  INSERT INTO `config_file_template` (`name`, `content`, `format`, `comment`, `create_time`
   802  	, `create_by`, `modify_time`, `modify_by`)
   803  VALUES ("spring-cloud-gateway-braining", '{
   804      "rules":[
   805          {
   806              "conditions":[
   807                  {
   808                      "key":"${http.query.uid}",
   809                      "values":["10000"],
   810                      "operation":"EQUALS"
   811                  }
   812              ],
   813              "labels":[
   814                  {
   815                      "key":"env",
   816                      "value":"green"
   817                  }
   818              ]
   819          }
   820      ]
   821  }', "json", "Spring Cloud Gateway  染色规则", NOW()
   822  	, "polaris", NOW(), "polaris");
   823  
   824  -- v1.12.0
   825  CREATE TABLE `routing_config_v2`
   826  (
   827      `id`       VARCHAR(128) NOT NULL,
   828      `name`     VARCHAR(64) NOT NULL default '',
   829      `namespace`     VARCHAR(64) NOT NULL default '',
   830      `policy`   VARCHAR(64) NOT NULL,
   831      `config`   TEXT,
   832      `enable`   INT         NOT NULL DEFAULT 0,
   833      `revision` VARCHAR(40) NOT NULL,
   834      `description` VARCHAR(500) NOT NULL DEFAULT '',
   835      `priority`   smallint(6)    NOT NULL DEFAULT '0' comment 'ratelimit rule priority',
   836      `flag`     TINYINT(4)  NOT NULL DEFAULT '0',
   837      `ctime`    TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
   838      `mtime`    TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   839      `etime`    TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
   840      `extend_info` VARCHAR(1024) DEFAULT '',
   841      PRIMARY KEY (`id`),
   842      KEY `mtime` (`mtime`)
   843  ) engine = innodb;
   844  
   845  CREATE TABLE `leader_election`
   846  (
   847      `elect_key` VARCHAR(128) NOT NULL,
   848      `version`   BIGINT NOT NULL DEFAULT 0,
   849      `leader`    VARCHAR(128) NOT NULL,
   850      `ctime`     TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
   851      `mtime`     TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   852      PRIMARY KEY (`elect_key`),
   853  	KEY `version` (`version`)
   854  ) engine = innodb;
   855  
   856  -- v1.14.0
   857  CREATE TABLE `circuitbreaker_rule_v2`
   858  (
   859      `id`                VARCHAR(128) NOT NULL,
   860      `name`              VARCHAR(64)  NOT NULL,
   861      `namespace`         VARCHAR(64)  NOT NULL default '',
   862      `enable`            INT          NOT NULL DEFAULT 0,
   863      `revision`          VARCHAR(40)  NOT NULL,
   864      `description`       VARCHAR(1024) NOT NULL DEFAULT '',
   865      `level`             INT          NOT NULL,
   866      `src_service`        VARCHAR(128) NOT NULL,
   867      `src_namespace`      VARCHAR(64)  NOT NULL,
   868      `dst_service`        VARCHAR(128) NOT NULL,
   869      `dst_namespace`      VARCHAR(64)  NOT NULL,
   870      `dst_method`         VARCHAR(128) NOT NULL,
   871      `config`            TEXT,
   872      `flag`              TINYINT(4)   NOT NULL DEFAULT '0',
   873      `ctime`             TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
   874      `mtime`             TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   875      `etime`             TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
   876      PRIMARY KEY (`id`),
   877      KEY `name` (`name`),
   878      KEY `mtime` (`mtime`)
   879  ) engine = innodb;
   880  
   881  CREATE TABLE `fault_detect_rule`
   882  (
   883      `id`            VARCHAR(128) NOT NULL,
   884      `name`          VARCHAR(64)  NOT NULL,
   885      `namespace`     VARCHAR(64)  NOT NULL default 'default',
   886      `revision`      VARCHAR(40)  NOT NULL,
   887      `description`   VARCHAR(1024) NOT NULL DEFAULT '',
   888      `dst_service`    VARCHAR(128) NOT NULL,
   889      `dst_namespace`  VARCHAR(64)  NOT NULL,
   890      `dst_method`     VARCHAR(128) NOT NULL,
   891      `config`        TEXT,
   892      `flag`          TINYINT(4)   NOT NULL DEFAULT '0',
   893      `ctime`         TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
   894      `mtime`         TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   895      PRIMARY KEY (`id`),
   896      KEY `name` (`name`),
   897      KEY `mtime` (`mtime`)
   898  ) engine = innodb;