Copilot commented on code in PR #10969:
URL: https://github.com/apache/gravitino/pull/10969#discussion_r3208353451


##########
scripts/mysql/upgrade-1.2.0-to-1.3.0-mysql.sql:
##########
@@ -78,3 +78,39 @@ CREATE TABLE IF NOT EXISTS `view_version_info` (
     KEY `idx_vvcid` (`catalog_id`),
     KEY `idx_vvsid` (`schema_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'view 
version info';
+
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    UNIQUE KEY `uk_iun_del` (`user_name`, `deleted_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'local IdP 
user metadata';

Review Comment:
   The PR description references running `TestSQLScripts`, but that test does 
not execute `upgrade-*-to-*.sql` scripts—so this new migration DDL is 
effectively untested. Please add a test that applies upgrade scripts (schema 
then upgrade) for each backend, or update/replace the existing script test to 
cover upgrades too.



##########
scripts/postgresql/upgrade-1.2.0-to-1.3.0-postgresql.sql:
##########
@@ -91,3 +91,65 @@ COMMENT ON COLUMN view_version_info.default_schema IS 
'default schema for view S
 COMMENT ON COLUMN view_version_info.representations IS 'view representations 
(JSON array)';
 COMMENT ON COLUMN view_version_info.audit_info IS 'view version audit info';
 COMMENT ON COLUMN view_version_info.deleted_at IS 'view version deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_user_meta (
+    user_id BIGINT NOT NULL,
+    user_name VARCHAR(128) NOT NULL,
+    password_hash VARCHAR(1024) NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (user_id),
+    UNIQUE (user_name, deleted_at)
+);
+COMMENT ON TABLE idp_user_meta IS 'local IdP user metadata';
+
+COMMENT ON COLUMN idp_user_meta.user_id IS 'idp user id';
+COMMENT ON COLUMN idp_user_meta.user_name IS 'idp username';
+COMMENT ON COLUMN idp_user_meta.password_hash IS 'idp user password hash';
+COMMENT ON COLUMN idp_user_meta.audit_info IS 'idp user audit info';
+COMMENT ON COLUMN idp_user_meta.current_version IS 'idp user current version';
+COMMENT ON COLUMN idp_user_meta.last_version IS 'idp user last version';
+COMMENT ON COLUMN idp_user_meta.deleted_at IS 'idp user deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_group_meta (
+    group_id BIGINT NOT NULL,
+    group_name VARCHAR(128) NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (group_id),
+    UNIQUE (group_name, deleted_at)
+);
+COMMENT ON TABLE idp_group_meta IS 'local IdP group metadata';
+
+COMMENT ON COLUMN idp_group_meta.group_id IS 'idp group id';
+COMMENT ON COLUMN idp_group_meta.group_name IS 'idp group name';
+COMMENT ON COLUMN idp_group_meta.audit_info IS 'idp group audit info';
+COMMENT ON COLUMN idp_group_meta.current_version IS 'idp group current 
version';
+COMMENT ON COLUMN idp_group_meta.last_version IS 'idp group last version';
+COMMENT ON COLUMN idp_group_meta.deleted_at IS 'idp group deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_group_user_rel (
+    id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+    group_id BIGINT NOT NULL,
+    user_id BIGINT NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (id),
+    UNIQUE (group_id, user_id, deleted_at)
+);
+CREATE INDEX IF NOT EXISTS idp_group_user_rel_idx_user_id ON 
idp_group_user_rel (user_id);

Review Comment:
   `idp_group_user_rel` defines a uniqueness constraint but only creates a 
secondary index on `user_id`. Other relation tables in this schema also create 
a dedicated index for the `group_id` side; consider adding an index on 
`group_id` here as well to avoid inefficient scans when listing members of a 
group (and keep schema/upgrade scripts consistent).
   



##########
scripts/postgresql/upgrade-1.2.0-to-1.3.0-postgresql.sql:
##########
@@ -91,3 +91,65 @@ COMMENT ON COLUMN view_version_info.default_schema IS 
'default schema for view S
 COMMENT ON COLUMN view_version_info.representations IS 'view representations 
(JSON array)';
 COMMENT ON COLUMN view_version_info.audit_info IS 'view version audit info';
 COMMENT ON COLUMN view_version_info.deleted_at IS 'view version deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_user_meta (
+    user_id BIGINT NOT NULL,
+    user_name VARCHAR(128) NOT NULL,
+    password_hash VARCHAR(1024) NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (user_id),
+    UNIQUE (user_name, deleted_at)
+);

Review Comment:
   The PR description says it was tested via `TestSQLScripts`, but that test 
does not execute `upgrade-*-to-*.sql` files (it only verifies naming and runs 
schema/metrics scripts). As a result, this new 1.2.0→1.3.0 migration DDL can 
ship with syntax/runtime issues unnoticed. Please add coverage that actually 
applies upgrade scripts (schema then upgrade) for each backend, or introduce a 
dedicated migration test for upgrade scripts.



##########
scripts/mysql/schema-1.3.0-mysql.sql:
##########
@@ -239,6 +239,42 @@ CREATE TABLE IF NOT EXISTS `group_role_rel` (
     KEY `idx_rid` (`group_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'group 
role relation';
 
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    UNIQUE KEY `uk_iun_del` (`user_name`, `deleted_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'local IdP 
user metadata';
+
+CREATE TABLE IF NOT EXISTS `idp_group_meta` (
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `group_name` VARCHAR(128) NOT NULL COMMENT 'idp group name',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp group audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp group 
deleted at',
+    PRIMARY KEY (`group_id`),
+    UNIQUE KEY `uk_ign_del` (`group_name`, `deleted_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'local IdP 
group metadata';
+
+CREATE TABLE IF NOT EXISTS `idp_group_user_rel` (
+    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'auto increment 
id',
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp group user relation audit 
info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp relation 
deleted at',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_igiu_del` (`group_id`, `user_id`, `deleted_at`),

Review Comment:
   `idp_group_user_rel` only adds a secondary index on `user_id`. To keep 
group-membership queries efficient (list users by `group_id`) and consistent 
with existing relation tables that create explicit indexes beyond the unique 
key, add an index on `group_id` too (and mirror it in the upgrade script).
   



##########
scripts/postgresql/schema-1.3.0-postgresql.sql:
##########
@@ -427,6 +427,68 @@ COMMENT ON COLUMN group_role_rel.current_version IS 
'relation current version';
 COMMENT ON COLUMN group_role_rel.last_version IS 'relation last version';
 COMMENT ON COLUMN group_role_rel.deleted_at IS 'relation deleted at';
 
+CREATE TABLE IF NOT EXISTS idp_user_meta (
+    user_id BIGINT NOT NULL,
+    user_name VARCHAR(128) NOT NULL,
+    password_hash VARCHAR(1024) NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (user_id),
+    UNIQUE (user_name, deleted_at)
+);
+COMMENT ON TABLE idp_user_meta IS 'local IdP user metadata';
+
+COMMENT ON COLUMN idp_user_meta.user_id IS 'idp user id';
+COMMENT ON COLUMN idp_user_meta.user_name IS 'idp username';
+COMMENT ON COLUMN idp_user_meta.password_hash IS 'idp user password hash';
+COMMENT ON COLUMN idp_user_meta.audit_info IS 'idp user audit info';
+COMMENT ON COLUMN idp_user_meta.current_version IS 'idp user current version';
+COMMENT ON COLUMN idp_user_meta.last_version IS 'idp user last version';
+COMMENT ON COLUMN idp_user_meta.deleted_at IS 'idp user deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_group_meta (
+    group_id BIGINT NOT NULL,
+    group_name VARCHAR(128) NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (group_id),
+    UNIQUE (group_name, deleted_at)
+);
+COMMENT ON TABLE idp_group_meta IS 'local IdP group metadata';
+
+COMMENT ON COLUMN idp_group_meta.group_id IS 'idp group id';
+COMMENT ON COLUMN idp_group_meta.group_name IS 'idp group name';
+COMMENT ON COLUMN idp_group_meta.audit_info IS 'idp group audit info';
+COMMENT ON COLUMN idp_group_meta.current_version IS 'idp group current 
version';
+COMMENT ON COLUMN idp_group_meta.last_version IS 'idp group last version';
+COMMENT ON COLUMN idp_group_meta.deleted_at IS 'idp group deleted at';
+
+CREATE TABLE IF NOT EXISTS idp_group_user_rel (
+    id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+    group_id BIGINT NOT NULL,
+    user_id BIGINT NOT NULL,
+    audit_info TEXT NOT NULL,
+    current_version INT NOT NULL DEFAULT 1,
+    last_version INT NOT NULL DEFAULT 1,
+    deleted_at BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (id),
+    UNIQUE (group_id, user_id, deleted_at)
+);

Review Comment:
   `idp_group_user_rel` only adds an index on `user_id`. For parity with other 
relation tables in this schema (e.g., `group_role_rel` has a dedicated 
`group_id` index), and to keep group-membership lookups efficient, add an index 
on `group_id` as well (and mirror it in the corresponding upgrade script).
   



##########
scripts/mysql/upgrade-1.2.0-to-1.3.0-mysql.sql:
##########
@@ -78,3 +78,39 @@ CREATE TABLE IF NOT EXISTS `view_version_info` (
     KEY `idx_vvcid` (`catalog_id`),
     KEY `idx_vvsid` (`schema_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'view 
version info';
+
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    UNIQUE KEY `uk_iun_del` (`user_name`, `deleted_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'local IdP 
user metadata';
+
+CREATE TABLE IF NOT EXISTS `idp_group_meta` (
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `group_name` VARCHAR(128) NOT NULL COMMENT 'idp group name',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp group audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp group 
deleted at',
+    PRIMARY KEY (`group_id`),
+    UNIQUE KEY `uk_ign_del` (`group_name`, `deleted_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT 'local IdP 
group metadata';
+
+CREATE TABLE IF NOT EXISTS `idp_group_user_rel` (
+    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'auto increment 
id',
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `audit_info` MEDIUMTEXT NOT NULL COMMENT 'idp group user relation audit 
info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp relation 
deleted at',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_igiu_del` (`group_id`, `user_id`, `deleted_at`),

Review Comment:
   `idp_group_user_rel` creates an index on `user_id` but none on `group_id`. 
Consider adding a `group_id` index as well to avoid relying on the wider unique 
index for common group-membership lookups, and keep it consistent with the 
schema script definition.
   



##########
scripts/h2/upgrade-1.2.0-to-1.3.0-h2.sql:
##########
@@ -64,3 +64,39 @@ CREATE TABLE IF NOT EXISTS `view_version_info` (
     KEY `idx_vvcid` (`catalog_id`),
     KEY `idx_vvsid` (`schema_id`)
 ) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` CLOB NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    CONSTRAINT `uk_iun_del` UNIQUE (`user_name`, `deleted_at`)
+) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_group_meta` (
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `group_name` VARCHAR(128) NOT NULL COMMENT 'idp group name',
+    `audit_info` CLOB NOT NULL COMMENT 'idp group audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp group 
deleted at',
+    PRIMARY KEY (`group_id`),
+    CONSTRAINT `uk_ign_del` UNIQUE (`group_name`, `deleted_at`)
+) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_group_user_rel` (
+    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'auto increment 
id',
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `audit_info` CLOB NOT NULL COMMENT 'idp group user relation audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp relation 
deleted at',
+    PRIMARY KEY (`id`),
+    CONSTRAINT `uk_igiu_del` UNIQUE (`group_id`, `user_id`, `deleted_at`),

Review Comment:
   `idp_group_user_rel` adds `KEY idx_iug_uid (user_id)` but no index on 
`group_id`. Consider adding a `group_id` index as well to avoid wider scans for 
group membership queries, and keep schema/upgrade definitions aligned.
   



##########
scripts/h2/upgrade-1.2.0-to-1.3.0-h2.sql:
##########
@@ -64,3 +64,39 @@ CREATE TABLE IF NOT EXISTS `view_version_info` (
     KEY `idx_vvcid` (`catalog_id`),
     KEY `idx_vvsid` (`schema_id`)
 ) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` CLOB NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    CONSTRAINT `uk_iun_del` UNIQUE (`user_name`, `deleted_at`)
+) ENGINE=InnoDB;

Review Comment:
   The PR description references running `TestSQLScripts`, but that test 
doesn't execute `upgrade-*-to-*.sql` files, so this new migration DDL isn't 
validated by CI. Please add upgrade-script execution coverage (schema then 
upgrade) for H2/MySQL/PostgreSQL, or add a dedicated migration test.



##########
scripts/h2/schema-1.3.0-h2.sql:
##########
@@ -248,6 +248,42 @@ CREATE TABLE IF NOT EXISTS `group_role_rel` (
     KEY `idx_gid` (`group_id`)
 ) ENGINE=InnoDB;
 
+CREATE TABLE IF NOT EXISTS `idp_user_meta` (
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `user_name` VARCHAR(128) NOT NULL COMMENT 'idp username',
+    `password_hash` VARCHAR(1024) NOT NULL COMMENT 'idp user password hash',
+    `audit_info` CLOB NOT NULL COMMENT 'idp user audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp user last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp user 
deleted at',
+    PRIMARY KEY (`user_id`),
+    CONSTRAINT `uk_iun_del` UNIQUE (`user_name`, `deleted_at`)
+) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_group_meta` (
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `group_name` VARCHAR(128) NOT NULL COMMENT 'idp group name',
+    `audit_info` CLOB NOT NULL COMMENT 'idp group audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp group last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp group 
deleted at',
+    PRIMARY KEY (`group_id`),
+    CONSTRAINT `uk_ign_del` UNIQUE (`group_name`, `deleted_at`)
+) ENGINE=InnoDB;
+
+CREATE TABLE IF NOT EXISTS `idp_group_user_rel` (
+    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'auto increment 
id',
+    `group_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp group id',
+    `user_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'idp user id',
+    `audit_info` CLOB NOT NULL COMMENT 'idp group user relation audit info',
+    `current_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation 
current version',
+    `last_version` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'idp relation last 
version',
+    `deleted_at` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'idp relation 
deleted at',
+    PRIMARY KEY (`id`),
+    CONSTRAINT `uk_igiu_del` UNIQUE (`group_id`, `user_id`, `deleted_at`),

Review Comment:
   `idp_group_user_rel` only defines a secondary index on `user_id`. Add an 
index on `group_id` as well to keep group→users lookups efficient and 
consistent with other relation tables (and update the matching upgrade script 
too).
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to