NOTE

How to Design a Configuration Center

What a configuration center is, why it is needed, storage, client notification, service discovery, caching, canary release, and an example configuration-center database design.

Software Architecture & EngineeringCreated Updated 2 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is a Configuration Center

A system used to centrally manage all configuration in a project.

2. Why a Configuration Center Is Needed

Traditional configuration is placed in configuration files and released together with code. With this approach, every configuration change requires the service to be released again.

A configuration center instead stores configuration on an independent configuration server. Users configure and adjust service configuration through a management interface, while individual services update dynamic configuration through Scheduled Pull or Server-side Push.

3. How to Implement a Configuration Center

3.1. Where Is the Data Stored?

  • MySQL. Configuration Center - Page 1

3.2. How Are Clients Notified of Configuration Updates?

  • push: has the highest real-time performance, but requires the application to maintain a long-lived connection with the configuration center. Complexity is higher, especially around load balancing.
  • poll: real-time performance is relatively worse. If incremental updates are not used, it also creates unnecessary pressure on the configuration center. However, implementation is much simpler.

3.3. How to Find the Configuration Service

  • Introduce a service registration and discovery mechanism.
  • Configuration Center - Page 2

3.4. How to Improve Performance

  • Introduce caching + cache updates. How to Design a Cache Architecture.md (original link is no longer valid)
  • Configuration Center - Page 3

3.5. How to Perform a Canary Release

  • Publish a configuration item to one machine to observe the effect, then decide whether to perform a full release or roll back.
    • Add a host property to the configuration item, indicating that this configuration item is only “published” to certain IPs.
    • Define a priority so that the client loads the local configuration file first. If applications on some machines need special configuration, the old approach can be used to modify their local configuration files.

4. Configuration-Center Components

4.1. Apollo

Apollo.md

4.2. Qicaishi

4.2.1. Flowchart

  • admin: after updating configuration in the database, write a notification to ZooKeeper.
  • config: ZooKeeper notifies the configuration service; the configuration service reads the database to obtain the latest configuration and updates the cache.

Configuration Center

4.2.2. Database Design

CREATE TABLE `tb_app_gray_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `gray_rule_type_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Canary rule type ID',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`gray_rule_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Project canary-rule table';



CREATE TABLE `tb_app_info` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(256) NOT NULL DEFAULT '' COMMENT 'Project ID, unique',
  `app_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Project name',
  `project_managers` varchar(500) NOT NULL DEFAULT '' COMMENT 'Owners',
  `dept` varchar(64) NOT NULL DEFAULT '' COMMENT 'Department',
  `description` varchar(500) NOT NULL DEFAULT '' COMMENT 'Project description',
  `creator` varchar(128) NOT NULL DEFAULT '' COMMENT 'Creator',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `is_delete` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1: valid, 2: deleted',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_name` (`app_name`)
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8 COMMENT='Project information table';

CREATE TABLE `tb_app_white_list` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `white_list_type_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Whitelist type ID',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`white_list_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Project whitelist table';

CREATE TABLE `tb_auto_group_map` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `group_rule_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Grouping rule ID',
  `ret_value` int(11) NOT NULL DEFAULT '0' COMMENT 'Return value',
  `group_name` varchar(256) NOT NULL  DEFAULT '' COMMENT 'Group name',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Automatic grouping rule return-value mapping table';

CREATE TABLE `tb_auto_group_ret_value` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `ret_value` int(11) NOT NULL DEFAULT '0' COMMENT 'Return value',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  PRIMARY KEY (`id`),
  KEY `RET_VALUE_APP_IDX` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Automatic grouping return-value table';

CREATE TABLE `tb_auto_group_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  `group_prefix` varchar(2048) NOT NULL COMMENT 'Group prefix',
  `name` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Rule name',
  `auto_rule_type_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Grouping rule type ID',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Status, 1: valid; 2: invalid',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Update time',
  PRIMARY KEY (`id`),
  KEY `GROUP_APP_IDX` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Automatic grouping rule table';

CREATE TABLE `tb_auto_group_rule_type` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `client_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier name',
  `name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Chinese name of the rule type',
  `en_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'English name of the rule type',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`en_name`,`client_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Automatic grouping rule-type table';

CREATE TABLE `tb_client_log_history` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `client_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier name',
  `client_value` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier value',
  `version_name` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version name',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Update time',
  `group_name` varchar(256) NOT NULL DEFAULT '' COMMENT 'Group name',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'AppID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_name`,`client_name`,`client_value`,`version_name`)
) ENGINE=InnoDB AUTO_INCREMENT=284944 DEFAULT CHARSET=utf8 COMMENT='Client history list';

CREATE TABLE `tb_client_log_lastest` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `client_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier name',
  `client_value` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier value',
  `version_name` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version name',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Update time',
  `group_name` varchar(256) NOT NULL DEFAULT '' COMMENT 'Group name',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'AppID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_name`,`client_name`,`client_value`)
) ENGINE=InnoDB AUTO_INCREMENT=284876 DEFAULT CHARSET=utf8 COMMENT='Latest client list';

CREATE TABLE `tb_config` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `ckey` varchar(256) NOT NULL COMMENT 'Configuration key',
  `cvalue` mediumtext NOT NULL COMMENT 'Configuration value',
  `value_type` int(11) NOT NULL COMMENT 'Value type (1-NUMBER;2-STRING;3-TEXT;4-JSON;5-XML;6-FILE)',
  `check_rule_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Data-type validation ID',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Configuration description',
  `version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Version ID',
  `value_md5` varchar(256) NOT NULL COMMENT 'MD5 of the configuration value',
  `from_group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Source group of the configuration key',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `app_id` varchar(256) NOT NULL DEFAULT '' COMMENT 'Project ID',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Status, 0: published, 1: modified, 2: added, 3: deleted, 4: publishing',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`version_id`,`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=2024 DEFAULT CHARSET=utf8 COMMENT='Configuration table';

CREATE TABLE `tb_config_mid` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `ckey` varchar(256) NOT NULL COMMENT 'Configuration key name',
  `cvalue` mediumtext NOT NULL COMMENT 'Configuration content',
  `value_type` int(11) NOT NULL COMMENT 'Value type (1-NUMBER;2-STRING;3-TEXT;4-JSON;5-XML;6-FILE)',
  `check_rule_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Data validation rule ID',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Description',
  `value_md5` varchar(256) NOT NULL DEFAULT '' COMMENT 'MD5 after change',
  `source_value_md5` varchar(256) NOT NULL DEFAULT '' COMMENT 'Initial MD5',
  `from_group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Source group ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `app_id` varchar(256) NOT NULL DEFAULT '' COMMENT 'AppID',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Status, 0: published, 1: modified, 2: added, 3: deleted, 4: publishing',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  `operator` varchar(64) NOT NULL DEFAULT '' COMMENT 'Operator',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=1923 DEFAULT CHARSET=utf8 COMMENT='Intermediate configuration table';

CREATE TABLE `tb_favorite_app` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `person` varchar(64) NOT NULL COMMENT 'Person who favorited the project',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  KEY `FAVOR_PERSON_IDX` (`person`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Project favorites table';

CREATE TABLE `tb_gray_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `task_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Release task ID',
  `gray_rule_type_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Canary rule type ID',
  `content` text NOT NULL COMMENT 'Canary rule content',
  `status` int(11) NOT NULL DEFAULT '1' COMMENT 'Status, 1: valid, 2: invalid',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP  COMMENT 'Update time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`task_id`),
  UNIQUE KEY `app_id_2` (`app_id`,`group_id`,`task_id`)
) ENGINE=InnoDB AUTO_INCREMENT=183 DEFAULT CHARSET=utf8 COMMENT='Canary-rule table';

CREATE TABLE `tb_gray_rule_mid` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `group_id` int(11) NOT NULL COMMENT 'Group ID',
  `task_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Release task ID',
  `gray_rule_type_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Canary rule type ID',
  `content` text NOT NULL COMMENT 'Canary rule content',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`task_id`)
) ENGINE=InnoDB AUTO_INCREMENT=388 DEFAULT CHARSET=utf8 COMMENT='Intermediate canary-rule table';

CREATE TABLE `tb_gray_rule_status` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `task_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Release task ID',
  `gray_rule_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Canary rule ID (0: being modified, >0: canary rule has been delivered)',
  `op_type` tinyint(4) NOT NULL COMMENT 'Operation type (1: add, 2: modify)',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`task_id`)
) ENGINE=InnoDB AUTO_INCREMENT=259 DEFAULT CHARSET=utf8 COMMENT='Canary-rule status table';

CREATE TABLE `tb_gray_rule_type` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `client_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier name',
  `name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Chinese name of the canary-rule type',
  `en_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'English name of the canary-rule type',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Canary-rule type table';

CREATE TABLE `tb_group` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `name` varchar(256) NOT NULL COMMENT 'Group name',
  `description` varchar(500) NOT NULL DEFAULT '' COMMENT 'Group description',
  `type` int(11) NOT NULL DEFAULT '0' COMMENT 'Group type (1: private, 2: public)',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Status, 1: valid, 2: invalid',
  `white_list_status` int(11) NOT NULL DEFAULT '2' COMMENT 'Whitelist status, 1: enabled, 2: disabled',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`name`,`status`)
) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8 COMMENT='Group information table';

CREATE TABLE `tb_group_lastest_version` (
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'AppID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `group_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Group name',
  `main_version` varchar(128) NOT NULL DEFAULT '' COMMENT 'Main version ID',
  `prev_main_version` varchar(128) NOT NULL DEFAULT '' COMMENT 'Previous main version ID',
  `gray_version` varchar(128) NOT NULL DEFAULT '' COMMENT 'Canary version ID',
  `lastest_event_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Latest task event ID',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
  `main_version_name` varchar(128) NOT NULL COMMENT 'Latest main version name',
  `gray_version_name` varchar(128) NOT NULL COMMENT 'Latest canary version name',
  UNIQUE KEY `app_id` (`app_id`,`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Latest configuration-version table';

CREATE TABLE `tb_group_relation` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `from_group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Source group ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `from_version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Source version ID',
  PRIMARY KEY (`id`),
  KEY `RELATION_GROUP_IDX` (`app_id`,`group_id`),
  KEY `RELATION_FROM_GROUP_IDX` (`app_id`,`from_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COMMENT='Group relationship table';

CREATE TABLE `tb_group_version_status` (
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Project ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Version ID (0: being modified, >0: version has been published)',
  `prev_version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Previous version ID',
  `status` int(11) NOT NULL DEFAULT '1' COMMENT 'Version status (1: version can be modified, 2: version is being published and cannot be modified)',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modification time',
  UNIQUE KEY `app_id` (`app_id`,`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Group version-status table';

CREATE TABLE `tb_release_task` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMNET 'Project ID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `group_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Group name',
  `version_name` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version name',
  `apply_user` varchar(128) NOT NULL DEFAULT '' COMMENT 'Release-task applicant',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Task status (1: waiting for approval, 2: approval rejected, 3: waiting for release, 4: fully released, 5: canary released, 6: rolled back, 7: task completed)',
  `reject_reason` text COMMENT 'Task rejection reason',
  `approval_user` varchar(128) NOT NULL DEFAULT '' COMMENT 'Approver',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Task description',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Current version number',
  `prev_version_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Previous version number',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
  PRIMARY KEY (`id`),
  KEY `TASK_APP_GROUP_NAME_IDX` (`app_id`,`group_id`,`group_name`)
) ENGINE=InnoDB AUTO_INCREMENT=304 DEFAULT CHARSET=utf8 COMMENT='Release-task information table';

CREATE TABLE `tb_release_task_config` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `ckey` varchar(256) NOT NULL COMMENT 'Configuration key',
  `cvalue`  mediumtext NOT NULL COMMENT 'Configuration value',
  `value_type` int(11) NOT NULL DEFAULT '0' COMMENT 'Value type (1-NUMBER;2-STRING;3-TEXT;4-JSON;5-XML;6-FILE)',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Configuration description',
  `task_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Task ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT 'Status, 0: published, 1: modified, 2: added, 3: deleted, 4: publishing',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`task_id`,`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=1662 DEFAULT CHARSET=utf8 COMMENT='Task configuration key/value intermediate table';

CREATE TABLE `tb_role` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `name` varchar(128) NOT NULL COMMENT 'Role name',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `persons` varchar(500) NOT NULL DEFAULT '' COMMENT 'Personnel list',
  `object` varchar(500) NOT NULL DEFAULT '' COMMENT 'Permission group name',
  `permission_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Permission type (1: view, 2: publish)',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  KEY `ROLE_APP_PERSONS_IDX` (`app_id`,`persons`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COMMENT='Role table';

CREATE TABLE `tb_task_event` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `event_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'Task type',
  `task_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Task ID',
  `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'AppID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `src_version_name` varchar(128) NOT NULL DEFAULT '0' COMMENT 'Source version name',
  `dst_version_name` varchar(128) NOT NULL DEFAULT '0' COMMENT 'Target version name',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  PRIMARY KEY (`id`),
  KEY `EVENT_APP_GROUP_IDX` (`app_id`,`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1053 DEFAULT CHARSET=utf8 COMMENT='Release-task event table';

CREATE TABLE `tb_value_check_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `value_type` int(11) NOT NULL COMMENT 'Value type (1-NUMBER;2-STRING;3-TEXT;4-JSON;5-XML;6-FILE)',
  `name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Data validation rule name',
  `content` varchar(64) NOT NULL DEFAULT '' COMMENT 'Data validation rule content',
  `check_type` int(11) NOT NULL DEFAULT '0' COMMENT 'Validation rule type (1: expression, 2: remote URL)',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`value_type`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='Configuration-value validation-rule table';

CREATE TABLE `tb_version_info` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `name` varchar(128) NOT NULL COMMENT 'Version name',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Version description',
  `creator` varchar(64) NOT NULL DEFAULT '' COMMENT 'Version creator',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `version_uuid` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version UUID',
  `status` int(11) NOT NULL DEFAULT '1' COMMENT 'Status (1: valid, 2: invalid)',
  PRIMARY KEY (`id`),
  KEY `VERSION_APP_GROUP_IDX` (`app_id`,`group_id`),
  KEY `VERSION_INFO_UUID` (`version_uuid`)
) ENGINE=InnoDB AUTO_INCREMENT=399 DEFAULT CHARSET=utf8 COMMENT='Version information table';

CREATE TABLE `tb_version_info_mid` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `name` varchar(128) NOT NULL COMMENT 'Version name',
  `description` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Version description',
  `creator` varchar(64) NOT NULL DEFAULT '' COMMENT 'Creator',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `version_uuid` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version UUID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=333 DEFAULT CHARSET=utf8 COMMENT='Intermediate version-information table';

CREATE TABLE `tb_version_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `version_name` varchar(128) NOT NULL COMMENT 'Version name',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `group_name` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Group name',
  `ckey` varchar(256) NOT NULL COMMENT 'Configuration key',
  `cvalue` mediumtext  NOT NULL COMMENT 'Configuration value',
  `op_type` int(11) NOT NULL DEFAULT '0' COMMENT 'Operation type (1: add, 2: modify)',
  `operator` varchar(2048) NOT NULL DEFAULT '' COMMENT 'Operator',
  `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modification time',
  `version_uuid` varchar(128) NOT NULL DEFAULT '' COMMENT 'Version UUID',
  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Group ID',
  PRIMARY KEY (`id`),
  KEY `VERSION_LOG_APP_IDX` (`app_id`,`version_name`,`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=1096 DEFAULT CHARSET=utf8 COMMENT='Version-update key/value history';

CREATE TABLE `tb_white_list` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `app_id` varchar(128) NOT NULL COMMENT 'Project ID',
  `group_id` int(11) NOT NULL COMMENT 'Group ID',
  `white_list_type_id` int(11) NOT NULL COMMENT 'Whitelist type ID',
  `content` text NOT NULL COMMENT 'Whitelist content',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `app_id` (`app_id`,`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8 COMMENT='Whitelist table';

CREATE TABLE `tb_white_list_type` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Auto-increment ID',
  `client_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Client identifier name',
  `name` varchar(64) NOT NULL DEFAULT '' COMMENT 'Chinese type name',
  `en_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'English type name',
  PRIMARY KEY (`id`),
  UNIQUE KEY `en_name` (`en_name`,`client_name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Whitelist type table';

5. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub