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

修改CHARSET = utf8mb4 COLLATE = utf8mb4_bin; #442

Merged
merged 5 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 59 additions & 65 deletions store/sqldb/scripts/delta/v160-v170.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
--
-- Database: `polaris_server`
--
CREATE
DATABASE IF NOT EXISTS `polaris_server` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

USE
`polaris_server`;

INSERT INTO `service` (`id`,
`name`,
Expand All @@ -38,112 +46,98 @@ VALUES ('e6542db1a2cc846c1866010b40b7f51f',
'2021-09-06 07:55:07',
'2021-09-06 07:55:11');


-- Support polarismesh Authentication Ability

-- User data
CREATE TABLE `user`
(
`id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'User ID',
`name` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'user name',
`password` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'user password',
`owner` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Main account ID',
`source` VARCHAR(32) COLLATE utf8_bin NOT NULL comment 'Account source',
`mobile` VARCHAR(12) COLLATE utf8_bin NOT NULL DEFAULT '' comment 'Account mobile phone number',
`email` VARCHAR(64) COLLATE utf8_bin NOT NULL DEFAULT '' comment 'Account mailbox',
`token` VARCHAR(255) COLLATE utf8_bin NOT NULL comment 'The token information owned by the account can be used for SDK access authentication',
`token_enable` tinyint(4) NOT NULL DEFAULT 1,
`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',
`comment` VARCHAR(255) COLLATE utf8_bin NOT NULL comment 'describe',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
`id` VARCHAR(128) NOT NULL comment 'User ID',
`name` VARCHAR(100) NOT NULL comment 'user name',
`password` VARCHAR(100) NOT NULL comment 'user password',
`owner` VARCHAR(128) NOT NULL comment 'Main account ID',
`source` VARCHAR(32) NOT NULL comment 'Account source',
`mobile` VARCHAR(12) NOT NULL DEFAULT '' comment 'Account mobile phone number',
`email` VARCHAR(64) NOT NULL DEFAULT '' comment 'Account mailbox',
`token` VARCHAR(255) NOT NULL comment 'The token information owned by the account can be used for SDK access authentication',
`token_enable` tinyint(4) NOT NULL DEFAULT 1,
`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',
`comment` VARCHAR(255) NOT NULL comment 'describe',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
PRIMARY KEY (`id`),
UNIQUE KEY (`name`, `owner`),
KEY `owner` (`owner`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- user group
CREATE TABLE `user_group`
(
`id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'User group ID',
`name` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'User group name',
`owner` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'The main account ID of the user group',
`token` VARCHAR(255) COLLATE utf8_bin NOT NULL comment 'TOKEN information of this user group',
`comment` VARCHAR(255) COLLATE utf8_bin NOT NULL comment 'Description',
`token_enable` tinyint(4) NOT NULL DEFAULT 1,
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
`id` VARCHAR(128) NOT NULL comment 'User group ID',
`name` VARCHAR(100) NOT NULL comment 'User group name',
`owner` VARCHAR(128) NOT NULL comment 'The main account ID of the user group',
`token` VARCHAR(255) NOT NULL comment 'TOKEN information of this user group',
`comment` VARCHAR(255) NOT NULL comment 'Description',
`token_enable` tinyint(4) NOT NULL DEFAULT 1,
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
PRIMARY KEY (`id`),
UNIQUE KEY (`name`, `owner`),
KEY `owner` (`owner`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- Users of users and user groups
CREATE TABLE `user_group_relation`
(
`user_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'User ID',
`group_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'User group ID',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
`user_id` VARCHAR(128) NOT NULL comment 'User ID',
`group_id` VARCHAR(128) NOT NULL comment 'User group ID',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
PRIMARY KEY (`user_id`, `group_id`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- Subject information of authentication strategy
CREATE TABLE `auth_strategy`
(
`id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Strategy ID',
`name` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'Policy name',
`action` VARCHAR(32) COLLATE utf8_bin NOT NULL comment 'Read and write permission for this policy, only_read = 0, read_write = 1',
`owner` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'The account ID to which this policy is',
`comment` VARCHAR(255) COLLATE utf8_bin NOT NULL comment 'describe',
`default` tinyint(4) NOT NULL DEFAULT '0',
`revision` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Authentication rule version',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
`id` VARCHAR(128) NOT NULL comment 'Strategy ID',
`name` VARCHAR(100) NOT NULL comment 'Policy name',
`action` VARCHAR(32) NOT NULL comment 'Read and write permission for this policy, only_read = 0, read_write = 1',
`owner` VARCHAR(128) NOT NULL comment 'The account ID to which this policy is',
`comment` VARCHAR(255) NOT NULL comment 'describe',
`default` tinyint(4) NOT NULL DEFAULT '0',
`revision` VARCHAR(128) NOT NULL comment 'Authentication rule version',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Whether the rules are valid, 0 is valid, 1 is invalid, it is deleted',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
PRIMARY KEY (`id`),
UNIQUE KEY (`name`, `owner`),
KEY `owner` (`owner`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- Member information, users and user groups in authentication strategies
CREATE TABLE `auth_principal`
(
`strategy_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Strategy ID',
`principal_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Principal ID',
`principal_role` int NOT NULL comment 'PRINCIPAL type, 1 is User, 2 is Group',
`strategy_id` VARCHAR(128) NOT NULL comment 'Strategy ID',
`principal_id` VARCHAR(128) NOT NULL comment 'Principal ID',
`principal_role` int NOT NULL comment 'PRINCIPAL type, 1 is User, 2 is Group',
PRIMARY KEY (`strategy_id`, `principal_id`, `principal_role`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- Resource information record involved in the authentication strategy
CREATE TABLE `auth_strategy_resource`
(
`strategy_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Strategy ID',
`res_type` int COLLATE utf8_bin NOT NULL comment 'Resource Type, Namespaces = 0, Service = 1, configgroups = 2',
`res_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'Resource ID',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
`strategy_id` VARCHAR(128) NOT NULL comment 'Strategy ID',
`res_type` int NOT NULL comment 'Resource Type, Namespaces = 0, Service = 1, configgroups = 2',
`res_id` VARCHAR(128) NOT NULL comment 'Resource ID',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'Create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'Last updated time',
PRIMARY KEY (`strategy_id`, `res_type`, `res_id`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
COLLATE = utf8_bin;
) ENGINE = InnoDB;

-- Create a default master account, password is Polarismesh @ 2021
INSERT INTO `user` (`id`,
Expand Down
54 changes: 32 additions & 22 deletions store/sqldb/scripts/delta/v170-v180.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,37 @@
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
--
-- Database: `polaris_server`
--
CREATE
DATABASE IF NOT EXISTS `polaris_server` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

CREATE TABLE `client` (
`id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'client id',
`host` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'client host IP',
`type` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'client type: polaris-java/polaris-go',
`version` VARCHAR(32) COLLATE utf8_bin NOT NULL comment 'client SDK version',
`region` varchar(128) COLLATE utf8_bin DEFAULT NULL comment 'region info for client',
`zone` varchar(128) COLLATE utf8_bin DEFAULT NULL comment 'zone info for client',
`campus` varchar(128) COLLATE utf8_bin DEFAULT NULL comment 'campus info for client',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 is valid, 1 is invalid(deleted)',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'last updated time',
PRIMARY KEY (`id`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_bin;
USE
`polaris_server`;

CREATE TABLE `client_stat` (
`client_id` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'client id',
`target` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'target stat platform',
`port` int(11) NOT NULL comment 'client port to get stat information',
`protocol` VARCHAR(100) COLLATE utf8_bin NOT NULL comment 'stat info transport protocol',
`path` VARCHAR(128) COLLATE utf8_bin NOT NULL comment 'stat metric path',
PRIMARY KEY (`client_id`, `target`, `port`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_bin;
CREATE TABLE `client`
(
`id` VARCHAR(128) NOT NULL comment 'client id',
`host` VARCHAR(100) NOT NULL comment 'client host IP',
`type` VARCHAR(100) NOT NULL comment 'client type: polaris-java/polaris-go',
`version` VARCHAR(32) NOT NULL comment 'client SDK version',
`region` varchar(128) DEFAULT NULL comment 'region info for client',
`zone` varchar(128) DEFAULT NULL comment 'zone info for client',
`campus` varchar(128) DEFAULT NULL comment 'campus info for client',
`flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 is valid, 1 is invalid(deleted)',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'create time',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'last updated time',
PRIMARY KEY (`id`),
KEY `mtime` (`mtime`)
) ENGINE = InnoDB;

CREATE TABLE `client_stat`
(
`client_id` VARCHAR(128) NOT NULL comment 'client id',
`target` VARCHAR(100) NOT NULL comment 'target stat platform',
`port` int(11) NOT NULL comment 'client port to get stat information',
`protocol` VARCHAR(100) NOT NULL comment 'stat info transport protocol',
`path` VARCHAR(128) NOT NULL comment 'stat metric path',
PRIMARY KEY (`client_id`, `target`, `port`)
) ENGINE = InnoDB;
Loading