Skip to content

Commit

Permalink
Add an id primary key column to both the roles and permissions tables…
Browse files Browse the repository at this point in the history
….(mysql-schema.sql) (#12206)
  • Loading branch information
HMYDK authored Jun 17, 2024
1 parent e192e25 commit 5d87196
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions config/src/main/resources/META-INF/mysql-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,27 @@ CREATE TABLE `tenant_info` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';

CREATE TABLE `users` (
`username` varchar(50) NOT NULL PRIMARY KEY COMMENT 'username',
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(50) NOT NULL COMMENT 'username',
`password` varchar(500) NOT NULL COMMENT 'password',
`enabled` boolean NOT NULL COMMENT 'enabled'
`enabled` boolean NOT NULL COMMENT 'enabled',
PRIMARY KEY (`id`)
);

CREATE TABLE `roles` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(50) NOT NULL COMMENT 'username',
`role` varchar(50) NOT NULL COMMENT 'role',
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
PRIMARY KEY (`id`),
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);

CREATE TABLE `permissions` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`role` varchar(50) NOT NULL COMMENT 'role',
`resource` varchar(128) NOT NULL COMMENT 'resource',
`action` varchar(8) NOT NULL COMMENT 'action',
PRIMARY KEY (`id`),
UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);

12 changes: 9 additions & 3 deletions distribution/conf/mysql-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,27 @@ CREATE TABLE `tenant_info` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';

CREATE TABLE `users` (
`username` varchar(50) NOT NULL PRIMARY KEY COMMENT 'username',
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(50) NOT NULL COMMENT 'username',
`password` varchar(500) NOT NULL COMMENT 'password',
`enabled` boolean NOT NULL COMMENT 'enabled'
`enabled` boolean NOT NULL COMMENT 'enabled',
PRIMARY KEY (`id`)
);

CREATE TABLE `roles` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(50) NOT NULL COMMENT 'username',
`role` varchar(50) NOT NULL COMMENT 'role',
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
PRIMARY KEY (`id`),
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);

CREATE TABLE `permissions` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`role` varchar(50) NOT NULL COMMENT 'role',
`resource` varchar(128) NOT NULL COMMENT 'resource',
`action` varchar(8) NOT NULL COMMENT 'action',
PRIMARY KEY (`id`),
UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);

0 comments on commit 5d87196

Please sign in to comment.