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

Add new indexing strategy to support case insensitivity #4127

Draft
wants to merge 1 commit into
base: 4.10.x
Choose a base branch
from
Draft
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
24 changes: 15 additions & 9 deletions distribution/kernel/carbon-home/dbscripts/db2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,12 @@ CREATE TABLE UM_USER(
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
PRIMARY KEY(UM_ID,UM_TENANT_ID),
UNIQUE(UM_USER_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
UNIQUE(UM_USER_ID)
)/

CREATE UNIQUE INDEX INDEX_UM_USERNAME_UM_TENANT_ID ON UM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)/
CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)/

CREATE UNIQUE INDEX INDEX_UM_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(UM_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)/

CREATE SEQUENCE UM_USER_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
Expand All @@ -463,10 +464,11 @@ CREATE TABLE UM_SYSTEM_USER (
UM_REQUIRE_CHANGE SMALLINT DEFAULT 0,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)/

CREATE UNIQUE INDEX INDEX_UM_LOWER_USER_NAME_UM_TENANT_ID ON UM_SYSTEM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)/

CREATE SEQUENCE UM_SYSTEM_USER_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
Expand Down Expand Up @@ -616,11 +618,12 @@ CREATE TABLE UM_USER_PERMISSION(
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
UNIQUE(UM_PERMISSION_ID,UM_USER_NAME,UM_TENANT_ID),
FOREIGN KEY(UM_PERMISSION_ID,UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID,UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY(UM_ID,UM_TENANT_ID)
)/

CREATE UNIQUE INDEX INDEX_UM_PERMISSION_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER_PERMISSION(UM_PERMISSION_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)/

CREATE SEQUENCE UM_USER_PERMISSION_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
Expand Down Expand Up @@ -663,11 +666,12 @@ CREATE TABLE UM_ACCOUNT_MAPPING(
UM_TENANT_ID INTEGER NOT NULL,
UM_USER_STORE_DOMAIN VARCHAR(100) NOT NULL,
UM_ACC_LINK_ID INTEGER NOT NULL,
UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID)
)/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_TENANT_ID_UM_USER_STORE_DOMAIN_UM_ACC_LINK_ID ON UM_ACCOUNT_MAPPING(LOWER(UM_USER_NAME), UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID)/

CREATE SEQUENCE UM_ACCOUNT_MAPPING_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
Expand Down Expand Up @@ -838,11 +842,12 @@ CREATE TABLE UM_HYBRID_USER_ROLE(
UM_ROLE_ID DECIMAL(31,0) NOT NULL,
UM_TENANT_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
UM_DOMAIN_ID DECIMAL(31,0) DEFAULT 0 NOT NULL,
UNIQUE(UM_USER_NAME,UM_ROLE_ID,UM_TENANT_ID),
FOREIGN KEY(UM_ROLE_ID,UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY(UM_ID,UM_TENANT_ID)
)/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID ON UM_HYBRID_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID)/

CREATE SEQUENCE UM_HYBRID_USER_ROLE_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
Expand Down Expand Up @@ -905,11 +910,12 @@ CREATE TABLE UM_SYSTEM_USER_ROLE(
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0 NOT NULL,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID ON UM_SYSTEM_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID)/

CREATE SEQUENCE UM_SYSTEM_USER_ROLE_SEQUENCE AS DECIMAL(27,0)
INCREMENT BY 1
START WITH 1
Expand Down
4 changes: 0 additions & 4 deletions distribution/kernel/carbon-home/dbscripts/mssql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ CREATE TABLE UM_TENANT (

IF EXISTS (SELECT NAME FROM SYSINDEXES WHERE NAME = 'INDEX_UM_TENANT_UM_DOMAIN_NAME')
DROP INDEX UM_TENANT.INDEX_UM_TENANT_UM_DOMAIN_NAME
CREATE INDEX INDEX_UM_TENANT_UM_DOMAIN_NAME ON UM_TENANT (UM_DOMAIN_NAME);
IF EXISTS (SELECT NAME FROM SYSINDEXES WHERE NAME = 'INDEX_UM_TENANT_ORG_UUID')
DROP INDEX UM_TENANT.INDEX_UM_TENANT_ORG_UUID
CREATE INDEX INDEX_UM_TENANT_ORG_UUID ON UM_TENANT(UM_ORG_UUID);
Expand All @@ -373,8 +372,6 @@ CREATE TABLE UM_USER (
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
);

CREATE UNIQUE INDEX INDEX_UM_USERNAME_UM_TENANT_ID ON UM_USER(UM_USER_NAME, UM_TENANT_ID);

--CREATE TABLE UM_DOMAIN
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[UM_DOMAIN]') AND TYPE IN (N'U'))
CREATE TABLE UM_DOMAIN(
Expand Down Expand Up @@ -470,7 +467,6 @@ CREATE TABLE UM_PERMISSION (

IF EXISTS (SELECT name FROM sysindexes WHERE name = 'INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION')
DROP INDEX UM_PERMISSION.INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION
CREATE INDEX INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID);

--CREATE TABLE UM_ROLE_PERMISSION

Expand Down
7 changes: 0 additions & 7 deletions distribution/kernel/carbon-home/dbscripts/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ CREATE TABLE UM_DOMAIN(
UNIQUE(UM_DOMAIN_NAME,UM_TENANT_ID)
)ENGINE INNODB;

CREATE UNIQUE INDEX INDEX_UM_TENANT_UM_DOMAIN_NAME
ON UM_TENANT (UM_DOMAIN_NAME);

CREATE TABLE UM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_ID VARCHAR(255) NOT NULL,
Expand All @@ -277,8 +274,6 @@ CREATE TABLE UM_USER (
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
)ENGINE INNODB;

CREATE UNIQUE INDEX INDEX_UM_USERNAME_UM_TENANT_ID ON UM_USER(UM_USER_NAME, UM_TENANT_ID);

CREATE TABLE UM_SYSTEM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
Expand Down Expand Up @@ -329,8 +324,6 @@ CREATE TABLE UM_PERMISSION (
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;

CREATE INDEX INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID);

CREATE TABLE UM_ROLE_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PERMISSION_ID INTEGER NOT NULL,
Expand Down
4 changes: 1 addition & 3 deletions distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ CREATE TABLE UM_USER (
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
)ENGINE NDB;

CREATE UNIQUE INDEX INDEX_UM_USERNAME_UM_TENANT_ID ON UM_USER(UM_USER_NAME, UM_TENANT_ID);
)ENGINE NDB;

CREATE TABLE UM_SYSTEM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
Expand Down
28 changes: 18 additions & 10 deletions distribution/kernel/carbon-home/dbscripts/oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ CREATE TABLE UM_USER (
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID))
UNIQUE(UM_USER_ID))
/

CREATE SEQUENCE UM_USER_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
Expand All @@ -439,8 +438,9 @@ CREATE OR REPLACE TRIGGER UM_USER_TRIGGER
SELECT UM_USER_SEQUENCE.nextval INTO :NEW.UM_ID FROM dual;
END;
/

CREATE UNIQUE INDEX INDEX_UM_USERNAME_UM_TENANT_ID ON UM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)
CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE UNIQUE INDEX INDEX_UM_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(UM_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE TABLE UM_SYSTEM_USER (
UM_ID INTEGER,
Expand All @@ -450,11 +450,13 @@ CREATE TABLE UM_SYSTEM_USER (
UM_REQUIRE_CHANGE NUMBER(1) DEFAULT 0,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID))
PRIMARY KEY (UM_ID, UM_TENANT_ID))

/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_SYSTEM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)
/

CREATE SEQUENCE UM_SYSTEM_USER_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
/

Expand Down Expand Up @@ -602,11 +604,12 @@ CREATE TABLE UM_USER_PERMISSION (
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_PERMISSION_ID, UM_USER_NAME, UM_TENANT_ID),
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
--FOREIGN KEY (UM_USER_ID) REFERENCES UM_USER(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID))
/
CREATE UNIQUE INDEX INDEX_UM_PERMISSION_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER_PERMISSION(UM_PERMISSION_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE SEQUENCE UM_USER_PERMISSION_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER UM_USER_PERMISSION_TRIGGER
Expand Down Expand Up @@ -671,12 +674,14 @@ CREATE TABLE UM_ACCOUNT_MAPPING(
UM_TENANT_ID INTEGER NOT NULL,
UM_USER_STORE_DOMAIN VARCHAR(100),
UM_ACC_LINK_ID INTEGER NOT NULL,
UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID)
)
/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_TENANT_ID_UM_USER_STORE_DOMAIN_UM_ACC_LINK_ID ON UM_ACCOUNT_MAPPING(LOWER(UM_USER_NAME), UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID)
/

CREATE SEQUENCE UM_ACCOUNT_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER UM_ACCOUNT_MAPPING_TRIGGER
Expand Down Expand Up @@ -833,12 +838,13 @@ CREATE TABLE UM_HYBRID_USER_ROLE(
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID,UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)
/
CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID_UM_DOMAIN_ID ON UM_HYBRID_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID)
/
CREATE SEQUENCE UM_HYBRID_USER_ROLE_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER UM_HYBRID_USER_ROLE_TRIGGER
Expand Down Expand Up @@ -924,12 +930,14 @@ CREATE TABLE UM_SYSTEM_USER_ROLE(
UM_USER_NAME VARCHAR(255),
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)
/

CREATE UNIQUE INDEX INDEX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID ON UM_SYSTEM_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID)
/

CREATE SEQUENCE UM_SYSTEM_USER_ROLE_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER UM_SYSTEM_USER_ROLE_TRIGGER
Expand Down
30 changes: 23 additions & 7 deletions distribution/kernel/carbon-home/dbscripts/oracle_rac.sql
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,11 @@ CREATE TABLE UM_USER (
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID))
UNIQUE(UM_USER_ID))
/
CREATE UNIQUE INDEX IDX_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE UNIQUE INDEX INDEX_UM_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_USER(UM_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE SEQUENCE UM_USER_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
Expand All @@ -432,8 +435,9 @@ CREATE TABLE UM_SYSTEM_USER (
UM_REQUIRE_CHANGE NUMBER(1) DEFAULT 0,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID))
PRIMARY KEY (UM_ID, UM_TENANT_ID))
/
CREATE UNIQUE INDEX IDX_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_SYSTEM_USER(LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE SEQUENCE UM_SYSTEM_USER_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
Expand Down Expand Up @@ -571,11 +575,12 @@ CREATE TABLE UM_USER_PERMISSION (
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_PERMISSION_ID, UM_USER_NAME, UM_TENANT_ID),
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
--FOREIGN KEY (UM_USER_ID) REFERENCES UM_USER(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID))
/
CREATE UNIQUE INDEX IDX_UM_PERMISSION_ID_LOWER_UM_USER_NAME_UM_TENANT_ID ON UM_SYSTEM_USER(UM_PERMISSION_ID, LOWER(UM_USER_NAME), UM_TENANT_ID)
/
CREATE SEQUENCE UM_USER_PERMISSION_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
CREATE OR REPLACE TRIGGER UM_USER_PERMISSION_TRIGGER
Expand Down Expand Up @@ -637,11 +642,12 @@ CREATE TABLE UM_ACCOUNT_MAPPING(
UM_TENANT_ID INTEGER NOT NULL,
UM_USER_STORE_DOMAIN VARCHAR(100),
UM_ACC_LINK_ID INTEGER NOT NULL,
UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID)
)
/
CREATE UNIQUE INDEX IDX_LOWER_UM_USER_NAME_UM_TENANT_ID_UM_USER_STORE_DOMAIN_UM_ACC_LINK_ID ON UM_ACCOUNT_MAPPING(LOWER(UM_USER_NAME), UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID)
/
CREATE SEQUENCE UM_ACCOUNT_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
CREATE OR REPLACE TRIGGER UM_ACCOUNT_MAPPING_TRIGGER
Expand Down Expand Up @@ -793,12 +799,13 @@ CREATE TABLE UM_HYBRID_USER_ROLE(
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID,UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)
/
CREATE UNIQUE INDEX IDX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID_UM_DOMAIN_ID ON UM_HYBRID_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID)
/
CREATE SEQUENCE UM_HYBRID_USER_ROLE_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
CREATE OR REPLACE TRIGGER UM_HYBRID_USER_ROLE_TRIGGER
Expand Down Expand Up @@ -882,6 +889,8 @@ CREATE TABLE UM_SYSTEM_USER_ROLE(
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)
/
CREATE UNIQUE INDEX IDX_LOWER_UM_USER_NAME_UM_ROLE_ID_UM_TENANT_ID ON UM_SYSTEM_USER_ROLE(LOWER(UM_USER_NAME), UM_ROLE_ID, UM_TENANT_ID)
/
CREATE SEQUENCE UM_SYSTEM_USER_ROLE_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20
/
CREATE OR REPLACE TRIGGER UM_SYSTEM_USER_ROLE_TRIGGER
Expand Down Expand Up @@ -939,6 +948,13 @@ CREATE OR REPLACE TRIGGER UM_GROUP_UUID_DOMAIN_MAPPER_TRIGGER
/
CREATE INDEX UUID_GRP_UID_TID ON UM_GROUP_UUID_DOMAIN_MAPPER(UM_GROUP_ID, UM_TENANT_ID)
/

CREATE INDEX IDX_USER_ROLE_USER_TENANT ON UM_USER_ROLE(UM_USER_ID,UM_TENANT_ID)
/
CREATE INDEX IDX_USER_ROLE_ROLE_TENANT ON UM_USER_ROLE(UM_ROLE_ID,UM_TENANT_ID)
/
CREATE INDEX IDX_USER_ATTRIBUTE_USER_TENANT ON UM_USER_ATTRIBUTE(UM_USER_ID,UM_TENANT_ID)
/
-- ################################
-- ORGANIZATION MANAGEMENT TABLES
-- ################################
Expand Down
Loading