-
Notifications
You must be signed in to change notification settings - Fork 392
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
[Subtask] Add relational backend for User Entity #2705
Comments
@qqqttt123 @xloya please help review the table for user and role CREATE TABLE IF NOT EXISTS `user_meta` (
`user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'user id',
`username` VARCHAR(256) NOT NULL COMMENT 'username',
`metalake_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'metalake id',
`catalog_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'catalog id',
`schema_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'schema id',
`audit_info` MEDIUMTEXT NOT NULL COMMENT 'user audit info',
`current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'user current version',
`last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'user last version',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'user deleted at',
PRIMARY KEY (`user_id`),
UNIQUE KEY `uk_sid_us_del` (`schema_id`, `username`, `deleted_at`),
KEY `idx_mid` (`metalake_id`),
KEY `idx_cid` (`catalog_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'user metadata'; CREATE TABLE IF NOT EXISTS `role_meta` (
`role_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'role id',
`role_name` VARCHAR(256) NOT NULL COMMENT 'role name',
`metalake_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'metalake id',
`catalog_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'catalog id',
`schema_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'schema id',
`audit_info` MEDIUMTEXT NOT NULL COMMENT 'role audit info',
`current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'role current version',
`last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'role last version',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'role deleted at',
PRIMARY KEY (`role_id`),
UNIQUE KEY `uk_sid_rn_del` (`schema_id`, `role_name`, `deleted_at`),
KEY `idx_mid` (`metalake_id`),
KEY `idx_cid` (`catalog_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'role metadata'; CREATE TABLE IF NOT EXISTS `user_role_rel` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'auto increment id',
`user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'user id',
`role_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'role id',
`current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'relation current version',
`last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'relation last version',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'relation deleted at',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ui_ri_del` (`user_id`, `role_id`, `deleted_at`),
KEY `idx_rid` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'user role relation'; |
username -> user_name. You should care about some other pull requests. Role entity may be different from your design. |
@qqqttt123 i will support role,group entity in another pr. when store user, need to store user-role relation meanwhile, so i design role's table in advance. we can adjust role design in role relation backend pr yes, |
I drafted a role entity pr #2772 |
Another thing is that user table doesn't need to store catalog and schema actually. They are fixed value. |
ok, i will remove it |
refer to #2772 , the role table CREATE TABLE IF NOT EXISTS `role_meta` (
`role_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'role id',
`role_name` VARCHAR(256) NOT NULL COMMENT 'role name',
`metalake_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'metalake id',
`properties` MEDIUMTEXT DEFAULT NULL COMMENT 'schema properties',
`audit_info` MEDIUMTEXT NOT NULL COMMENT 'role audit info',
`current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'role current version',
`last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'role last version',
`deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'role deleted at',
PRIMARY KEY (`role_id`),
UNIQUE KEY `uk_mid_rn_del` (`metalake_id`, `role_name`, `deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'role metadata'; and will design a privilege table to store role-resource privilege |
### What changes were proposed in this pull request? add relational backend for User Entity ### Why are the changes needed? Fix: #2705 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? ut --------- Co-authored-by: yangliwei <yangliwei@xiaomi.com>
…pache#2850) ### What changes were proposed in this pull request? add relational backend for User Entity ### Why are the changes needed? Fix: apache#2705 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? ut --------- Co-authored-by: yangliwei <yangliwei@xiaomi.com>
Describe the subtask
Add relational backend for User Entity
Parent issue
#2234
The text was updated successfully, but these errors were encountered: