Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix apolloconfigdb.sql apolloportaldb.sql AppId length settings are inconsistent #4725

Merged
merged 13 commits into from
Feb 11, 2023

Conversation

weiyichao
Copy link
Contributor

What's the purpose of this PR

When I initialized the database script, I found that the size of the AppId field in each table was inconsistent. I think it needs a uniform size of varchar 64.

For example, AppId is the logical foreign key of the database table AppNamespace. The size of AppId needs to be consistent and should be set to 64. Why not 500? Because when I try to put the UNIQUE index on the AppId VARCHAR(500) field, it will prompt the specified key was too long; max key length is 767 bytes, in the utf8mb4 character set mode, the field length should be less than 191.

And the front-end page design has made a check that the length cannot be greater than 64。

image

So I think the size of appId should be set to varchar 64.

According to the database script information, the database App table sets the size of AppId to 500.

CREATE TABLE `App` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
  `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
  `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
  `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
  `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
  `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
  `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `UK_AppId_DeletedAt` (`AppId`,`DeletedAt`),
  KEY `DataChange_LastTime` (`DataChange_LastTime`),
  KEY `IX_Name` (`Name`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';

According to the database script information, the database AppNamespace table sets the size of AppId to 64.

CREATE TABLE `AppNamespace` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
  `AppId` varchar(64) NOT NULL DEFAULT '' COMMENT 'app id',
  `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型',
  `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共',
  `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释',
  `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
  `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
  `DataChange_CreatedBy` varchar(64) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
  `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '最后修改人邮箱前缀',
  `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `UK_AppId_Name_DeletedAt` (`AppId`,`Name`,`DeletedAt`),
  KEY `Name_AppId` (`Name`,`AppId`),
  KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';

Brief changelog

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Update the CHANGES log.

@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #4725 (b763f34) into master (a0c09b5) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #4725   +/-   ##
=========================================
  Coverage     47.22%   47.22%           
  Complexity     1661     1661           
=========================================
  Files           349      349           
  Lines         10691    10691           
  Branches       1062     1062           
=========================================
  Hits           5049     5049           
- Misses         5334     5335    +1     
+ Partials        308      307    -1     
Impacted Files Coverage Δ
...nfigservice/filter/ClientAuthenticationFilter.java 91.48% <0.00%> (-2.13%) ⬇️
...ervice/service/ReleaseMessageServiceWithCache.java 87.05% <0.00%> (+1.17%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

CHANGES.md Outdated Show resolved Hide resolved
scripts/sql/apolloconfigdb.sql Show resolved Hide resolved
@weiyichao
Copy link
Contributor Author

I have updated the relevant question, please review it for me.

CHANGES.md Outdated Show resolved Hide resolved
nobodyiam
nobodyiam previously approved these changes Feb 11, 2023
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam enabled auto-merge February 11, 2023 08:06
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam added this pull request to the merge queue Feb 11, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 11, 2023
@nobodyiam nobodyiam added this pull request to the merge queue Feb 11, 2023
@nobodyiam nobodyiam removed this pull request from the merge queue due to a manual request Feb 11, 2023
@nobodyiam nobodyiam merged commit d9726af into apolloconfig:master Feb 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2023
@nobodyiam nobodyiam added this to the 2.2.0 milestone Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants