Skip to content

Commit

Permalink
Fix db2 db scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Apr 1, 2024
1 parent a8978ae commit 3cfb3c3
Showing 1 changed file with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ CREATE TABLE IDN_SCIM_GROUP (
ROLE_NAME VARCHAR(255) NOT NULL,
ATTR_NAME VARCHAR(1024) NOT NULL,
ATTR_VALUE VARCHAR(1024),
UNIQUE(TENANT_ID,ROLE_NAME,ATTR_NAME),
CONSTRAINT IDX_IDN_SCIM_GROUP_TI_RN_AN UNIQUE(TENANT_ID,ROLE_NAME,ATTR_NAME),
PRIMARY KEY (ID)) IN TS32K
/

Expand Down Expand Up @@ -1429,7 +1429,7 @@ CREATE TABLE IDN_OIDC_SCOPE_CLAIM_MAPPING (
PRIMARY KEY (ID),
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE(SCOPE_ID) ON DELETE CASCADE,
FOREIGN KEY (EXTERNAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
UNIQUE (SCOPE_ID, EXTERNAL_CLAIM_ID))
CONSTRAINT IDX_AT_SI_ECI UNIQUE (SCOPE_ID, EXTERNAL_CLAIM_ID))
/
CREATE SEQUENCE IDN_OIDC_SCOPE_CLAIM_MAP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
Expand Down Expand Up @@ -1775,8 +1775,6 @@ CREATE INDEX IDX_AC_AC_CKID ON IDN_OAUTH2_AUTHORIZATION_CODE(AUTHORIZATION_CODE,
-- IDN_SCIM_GROUP --
CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME)
/
CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN_AN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME, ATTR_NAME)
/

-- IDN_AUTH_SESSION_STORE --
CREATE INDEX IDX_IDN_AUTH_SESSION_TIME ON IDN_AUTH_SESSION_STORE (TIME_CREATED)
Expand All @@ -1790,10 +1788,6 @@ CREATE INDEX IDX_IDN_AUTH_SSTR_ET_ID ON IDN_AUTH_SESSION_STORE (EXPIRY_TIME, SES
CREATE INDEX IDX_IDN_AUTH_TMP_SESSION_TIME ON IDN_AUTH_TEMP_SESSION_STORE (TIME_CREATED)
/

-- IDN_OIDC_SCOPE_CLAIM_MAPPING --
CREATE INDEX IDX_AT_SI_ECI ON IDN_OIDC_SCOPE_CLAIM_MAPPING(SCOPE_ID, EXTERNAL_CLAIM_ID)
/

-- IDN_OAUTH2_SCOPE --
CREATE INDEX IDX_SC_TID ON IDN_OAUTH2_SCOPE(TENANT_ID)
/
Expand All @@ -1810,10 +1804,6 @@ CREATE INDEX IDX_OROR_TID ON IDN_OIDC_REQ_OBJECT_REFERENCE(TOKEN_ID)
CREATE INDEX IDX_ATS_TID ON IDN_OAUTH2_ACCESS_TOKEN_SCOPE(TOKEN_ID)
/

-- SP_TEMPLATE --
CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID, NAME)
/

-- IDN_AUTH_USER --
CREATE INDEX IDX_AUTH_USER_UN_TID_DN ON IDN_AUTH_USER (USER_NAME, TENANT_ID, DOMAIN_NAME)
/
Expand Down Expand Up @@ -2048,7 +2038,7 @@ CREATE TABLE IDN_APP_REVOKED_EVENT (
EVENT_ID VARCHAR(255) NOT NULL,
CONSUMER_KEY VARCHAR(255) NOT NULL,
TIME_REVOKED TIMESTAMP NOT NULL,
ORGANIZATION VARCHAR(100),
ORGANIZATION VARCHAR(100) NOT NULL,
PRIMARY KEY (EVENT_ID),
CONSTRAINT CON_APP_EVT_KEY UNIQUE (CONSUMER_KEY, ORGANIZATION))
/
Expand All @@ -2058,7 +2048,7 @@ CREATE TABLE IDN_SUBJECT_ENTITY_REVOKED_EVENT (
ENTITY_ID VARCHAR(255) NOT NULL,
ENTITY_TYPE VARCHAR(100) NOT NULL,
TIME_REVOKED TIMESTAMP NOT NULL,
ORGANIZATION VARCHAR(100),
ORGANIZATION VARCHAR(100) NOT NULL,
PRIMARY KEY (EVENT_ID),
CONSTRAINT CON_SUB_EVT_KEY UNIQUE (ENTITY_ID, ENTITY_TYPE, ORGANIZATION))
/
Expand Down Expand Up @@ -2381,7 +2371,7 @@ CREATE TABLE AM_API_RESOURCE_SCOPE_MAPPING (
CREATE TABLE AM_SECURITY_AUDIT_UUID_MAPPING (
API_ID INTEGER NOT NULL,
AUDIT_UUID VARCHAR(255) NOT NULL,
FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT,
FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE,
PRIMARY KEY (API_ID)
)/

Expand Down Expand Up @@ -2436,7 +2426,7 @@ CREATE TABLE AM_API_LC_EVENT (
USER_ID VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
EVENT_DATE TIMESTAMP NOT NULL,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE,
PRIMARY KEY (EVENT_ID)
)/

Expand Down Expand Up @@ -2466,8 +2456,8 @@ CREATE TABLE AM_API_RATINGS (
API_ID INTEGER,
RATING INTEGER,
SUBSCRIBER_ID INTEGER,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT,
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE RESTRICT,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE,
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE CASCADE,
PRIMARY KEY (RATING_ID)
)/

Expand Down Expand Up @@ -2630,6 +2620,8 @@ CREATE TABLE AM_POLICY_APPLICATION (
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED SMALLINT NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
RATE_LIMIT_COUNT INT NULL DEFAULT 0,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
UUID VARCHAR(256) NOT NULL,
PRIMARY KEY (POLICY_ID),
CONSTRAINT APP_NAME_TENANT UNIQUE (NAME, TENANT_ID),
Expand Down Expand Up @@ -2872,7 +2864,7 @@ CREATE TABLE AM_KEY_MANAGER (
CREATE TABLE AM_KEY_MANAGER_PERMISSIONS (
KEY_MANAGER_UUID VARCHAR(50) NOT NULL,
PERMISSIONS_TYPE VARCHAR(50) NOT NULL,
ROLE VARCHAR(255),
ROLE VARCHAR(255) NOT NULL,
PRIMARY KEY (KEY_MANAGER_UUID, ROLE),
FOREIGN KEY (KEY_MANAGER_UUID) REFERENCES AM_KEY_MANAGER(UUID) ON DELETE CASCADE
)
Expand Down Expand Up @@ -2904,7 +2896,7 @@ CREATE TABLE AM_GW_API_ARTIFACTS (
API_ID varchar(255) NOT NULL,
REVISION_ID varchar(255) NOT NULL,
ARTIFACT blob,
TIME_STAMP TIMESTAMP NOT NULL GENERATED ALWAYS FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP,
TIME_STAMP TIMESTAMP NOT NULL GENERATED BY DEFAULT FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP,
PRIMARY KEY (REVISION_ID, API_ID),
FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS (API_ID) ON DELETE NO ACTION ON UPDATE RESTRICT)
/
Expand Down Expand Up @@ -3201,8 +3193,8 @@ CREATE TABLE AM_GATEWAY_POLICY_MAPPING (
POLICY_ORDER INTEGER NOT NULL,
DIRECTION VARCHAR(10) NOT NULL,
PARAMETERS VARCHAR(1024) NOT NULL,
FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY (POLICY_UUID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (GLOBAL_POLICY_MAPPING_UUID) REFERENCES AM_GATEWAY_POLICY_METADATA (GLOBAL_POLICY_MAPPING_UUID) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY (POLICY_UUID) ON DELETE RESTRICT,
FOREIGN KEY (GLOBAL_POLICY_MAPPING_UUID) REFERENCES AM_GATEWAY_POLICY_METADATA (GLOBAL_POLICY_MAPPING_UUID) ON DELETE CASCADE,
PRIMARY KEY (POLICY_TO_FLOW_INFO_MAPPING_ID)
)
/
Expand All @@ -3211,7 +3203,7 @@ CREATE TABLE AM_GATEWAY_POLICY_DEPLOYMENT (
GATEWAY_LABEL VARCHAR(255) NOT NULL,
GLOBAL_POLICY_MAPPING_UUID VARCHAR(45) NOT NULL,
ORGANIZATION VARCHAR(100) NOT NULL,
FOREIGN KEY (GLOBAL_POLICY_MAPPING_UUID) REFERENCES AM_GATEWAY_POLICY_METADATA (GLOBAL_POLICY_MAPPING_UUID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (GLOBAL_POLICY_MAPPING_UUID) REFERENCES AM_GATEWAY_POLICY_METADATA (GLOBAL_POLICY_MAPPING_UUID) ON DELETE RESTRICT,
PRIMARY KEY (ORGANIZATION,GATEWAY_LABEL)
)
/
Expand Down Expand Up @@ -3248,7 +3240,7 @@ CREATE TABLE AM_APP_REVOKED_EVENT
(
CONSUMER_KEY VARCHAR(255) NOT NULL,
TIME_REVOKED TIMESTAMP NOT NULL,
ORGANIZATION VARCHAR(100),
ORGANIZATION VARCHAR(100) NOT NULL,
PRIMARY KEY (CONSUMER_KEY, ORGANIZATION)
)
/
Expand All @@ -3258,7 +3250,7 @@ CREATE TABLE AM_SUBJECT_ENTITY_REVOKED_EVENT
ENTITY_ID VARCHAR(255) NOT NULL,
ENTITY_TYPE VARCHAR(100) NOT NULL,
TIME_REVOKED TIMESTAMP NOT NULL,
ORGANIZATION VARCHAR(100),
ORGANIZATION VARCHAR(100) NOT NULL,
PRIMARY KEY (ENTITY_ID, ENTITY_TYPE, ORGANIZATION)
)
/
Expand Down

0 comments on commit 3cfb3c3

Please sign in to comment.