Update api manager db scripts to 6.0.5 version

application-manager-new
warunalakshitha 8 years ago
parent 38fb8ac197
commit 82a352242c

@ -17,6 +17,8 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR (128),
CALLBACK_URL VARCHAR (1024),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
);
@ -88,6 +90,8 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR (255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
);
@ -199,7 +203,7 @@ CREATE TABLE IDN_AUTH_SESSION_STORE (
SESSION_OBJECT BLOB,
TIME_CREATED BIGINT,
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)
PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)
);
CREATE TABLE IF NOT EXISTS SP_APP (
ID INTEGER NOT NULL AUTO_INCREMENT,
@ -331,6 +335,7 @@ CREATE TABLE IF NOT EXISTS IDP (
DISPLAY_NAME VARCHAR(255),
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, NAME));
INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost');
CREATE TABLE IF NOT EXISTS IDP_ROLE (
@ -410,8 +415,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY (
IS_SECRET CHAR (1) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY),
FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE
);
FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE);
INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0');
INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 3 , 'IdPEntityId', 'localhost', '0');
@ -465,7 +469,6 @@ CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM (
UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID (
ID INTEGER AUTO_INCREMENT,
IDP_USER_ID VARCHAR(255) NOT NULL,
@ -508,8 +511,8 @@ CREATE TABLE IF NOT EXISTS WF_REQUEST (
CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE (
PROFILE_NAME VARCHAR(45),
HOST_URL_MANAGER VARCHAR(45),
HOST_URL_WORKER VARCHAR(45),
HOST_URL_MANAGER VARCHAR(255),
HOST_URL_WORKER VARCHAR(255),
USERNAME VARCHAR(45),
PASSWORD VARCHAR(255),
CALLBACK_HOST VARCHAR (45),
@ -613,6 +616,7 @@ CREATE TABLE IF NOT EXISTS AM_API (
API_VERSION VARCHAR(30),
CONTEXT VARCHAR(256),
CONTEXT_TEMPLATE VARCHAR(256),
API_TIER VARCHAR(256),
PRIMARY KEY(API_ID),
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP,
@ -777,4 +781,209 @@ CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION (
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
-- End of API-MGT Tables --
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER AUTO_INCREMENT,
ALERT_TYPE_NAME VARCHAR(256) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID)
);
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(256) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONSTRAINT UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)
);
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER AUTO_INCREMENT,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
PRIMARY KEY (EMAIL_LIST_ID),
CONSTRAINT AM_ALERT_EMAILLIST_CONSTRAINT UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER)
);
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAILLIST_DETAILS_CONSTRAINT UNIQUE (EMAIL_LIST_ID,EMAIL)
);
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher');
-- AM Throttling tables --
CREATE TABLE IF NOT EXISTS AM_POLICY_SUBSCRIPTION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
RATE_LIMIT_COUNT INT(11) NULL DEFAULT NULL,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
STOP_ON_QUOTA_REACH BOOLEAN NOT NULL DEFAULT 0,
BILLING_PLAN VARCHAR(20) NOT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX AM_POLICY_SUBSCRIPTION_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE TABLE IF NOT EXISTS AM_POLICY_APPLICATION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX APP_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE TABLE IF NOT EXISTS AM_POLICY_HARD_THROTTLING (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX POLICY_HARD_NAME_TENANT (NAME, TENANT_ID)
);
CREATE TABLE IF NOT EXISTS AM_API_THROTTLE_POLICY (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR (1024),
DEFAULT_QUOTA_TYPE VARCHAR(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX API_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE TABLE IF NOT EXISTS AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER NOT NULL AUTO_INCREMENT,
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
DESCRIPTION VARCHAR (1024) NULL DEFAULT NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR(255) DEFAULT NULL,
IS_PARAM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR(1024) DEFAULT NULL,
IS_CLAIM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS AM_IP_CONDITION (
AM_IP_CONDITION_ID INT NOT NULL AUTO_INCREMENT,
STARTING_IP VARCHAR(45) NULL,
ENDING_IP VARCHAR(45) NULL,
SPECIFIC_IP VARCHAR(45) NULL,
WITHIN_IP_RANGE BOOLEAN DEFAULT 1,
CONDITION_GROUP_ID INT NULL,
PRIMARY KEY (AM_IP_CONDITION_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE);
CREATE TABLE IF NOT EXISTS AM_POLICY_GLOBAL (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
KEY_TEMPLATE VARCHAR(512) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
SIDDHI_QUERY BLOB DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
);
CREATE TABLE IF NOT EXISTS AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INT NOT NULL AUTO_INCREMENT,
TIER VARCHAR(50) NULL,
PERMISSIONS_TYPE VARCHAR(50) NULL,
ROLES VARCHAR(512) NULL,
TENANT_ID INT(11) NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID));
CREATE TABLE `AM_BLOCK_CONDITIONS` (
`CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT,
`TYPE` varchar(45) DEFAULT NULL,
`VALUE` varchar(45) DEFAULT NULL,
`ENABLED` varchar(45) DEFAULT NULL,
`DOMAIN` varchar(45) DEFAULT NULL,
`UUID` VARCHAR(256),
PRIMARY KEY (`CONDITION_ID`),
UNIQUE (UUID)
);
-- End of API-MGT Tables --

@ -19,6 +19,8 @@ CREATE TABLE IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR(128),
CALLBACK_URL VARCHAR(1024),
GRANT_TYPES VARCHAR(1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
);
@ -97,6 +99,8 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR (255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
);
@ -242,9 +246,8 @@ CREATE TABLE SP_APP (
SUBJECT_CLAIM_URI VARCHAR (512),
IS_SAAS_APP CHAR(1) DEFAULT '0',
IS_DUMB_MODE CHAR(1) DEFAULT '0',
PRIMARY KEY (ID));
ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID);
PRIMARY KEY (ID),
CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID));
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_METADATA]') AND TYPE IN (N'U'))
CREATE TABLE SP_METADATA (
@ -267,9 +270,8 @@ CREATE TABLE SP_INBOUND_AUTH (
PROP_NAME VARCHAR (255),
PROP_VALUE VARCHAR (1024) ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID));
ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID),
CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_AUTH_STEP]') AND TYPE IN (N'U'))
CREATE TABLE SP_AUTH_STEP (
@ -279,18 +281,16 @@ CREATE TABLE SP_AUTH_STEP (
APP_ID INTEGER NOT NULL,
IS_SUBJECT_STEP CHAR(1) DEFAULT '0',
IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0',
PRIMARY KEY (ID));
ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID),
CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_FEDERATED_IDP]') AND TYPE IN (N'U'))
CREATE TABLE SP_FEDERATED_IDP (
ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
AUTHENTICATOR_ID INTEGER NOT NULL,
PRIMARY KEY (ID, AUTHENTICATOR_ID));
ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID, AUTHENTICATOR_ID),
CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_CLAIM_MAPPING]') AND TYPE IN (N'U'))
CREATE TABLE SP_CLAIM_MAPPING (
@ -301,9 +301,8 @@ CREATE TABLE SP_CLAIM_MAPPING (
APP_ID INTEGER NOT NULL,
IS_REQUESTED VARCHAR(128) DEFAULT '0',
DEFAULT_VALUE VARCHAR(255),
PRIMARY KEY (ID));
ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID),
CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_ROLE_MAPPING]') AND TYPE IN (N'U'))
CREATE TABLE SP_ROLE_MAPPING (
@ -311,10 +310,9 @@ CREATE TABLE SP_ROLE_MAPPING (
TENANT_ID INTEGER NOT NULL,
IDP_ROLE VARCHAR (255) NOT NULL ,
SP_ROLE VARCHAR (255) NOT NULL ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID));
ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_REQ_PATH_AUTHENTICATOR]') AND TYPE IN (N'U'))
CREATE TABLE SP_REQ_PATH_AUTHENTICATOR (
@ -322,9 +320,8 @@ CREATE TABLE SP_REQ_PATH_AUTHENTICATOR (
TENANT_ID INTEGER NOT NULL,
AUTHENTICATOR_NAME VARCHAR (255) NOT NULL ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID));
ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID),
CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_PROVISIONING_CONNECTOR]') AND TYPE IN (N'U'))
CREATE TABLE SP_PROVISIONING_CONNECTOR (
@ -335,9 +332,8 @@ CREATE TABLE SP_PROVISIONING_CONNECTOR (
APP_ID INTEGER NOT NULL,
IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0',
BLOCKING CHAR(1) NOT NULL DEFAULT '0',
PRIMARY KEY (ID));
ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
PRIMARY KEY (ID),
CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP]') AND TYPE IN (N'U'))
CREATE TABLE IDP (
@ -361,7 +357,7 @@ CREATE TABLE IDP (
IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0',
IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0',
PRIMARY KEY (ID),
DISPLAY_NAME VARCHAR(255),
DISPLAY_NAME VARCHAR(255),
UNIQUE (TENANT_ID, NAME));
INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost');
@ -555,13 +551,11 @@ CREATE TABLE WF_REQUEST (
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_BPS_PROFILE]') AND TYPE IN (N'U'))
CREATE TABLE WF_BPS_PROFILE (
PROFILE_NAME VARCHAR(45),
HOST_URL_MANAGER VARCHAR(45),
HOST_URL_WORKER VARCHAR(45),
HOST_URL_MANAGER VARCHAR(255),
HOST_URL_WORKER VARCHAR(255),
USERNAME VARCHAR(45),
PASSWORD VARCHAR(255),
CALLBACK_HOST VARCHAR (45),
CALLBACK_USERNAME VARCHAR (45),
CALLBACK_PASSWORD VARCHAR (255),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (PROFILE_NAME, TENANT_ID)
);
@ -625,6 +619,7 @@ CREATE TABLE WF_WORKFLOW_REQUEST_RELATION(
FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE
);
-- Start of API-Mgt Tables --
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_SUBSCRIBER]') AND TYPE IN (N'U'))
@ -674,6 +669,7 @@ CREATE TABLE AM_API (
API_VERSION VARCHAR(30),
CONTEXT VARCHAR(256),
CONTEXT_TEMPLATE VARCHAR(256),
API_TIER VARCHAR(256),
CREATED_BY VARCHAR(100),
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR(100),
@ -865,4 +861,243 @@ CREATE TABLE AM_API_DEFAULT_VERSION (
);
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
CREATE TABLE AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER NOT NULL IDENTITY,
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(10) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID)
);
CREATE TABLE AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONST UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)
);
CREATE TABLE AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER NOT NULL IDENTITY,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_EMAILLIST_CONST UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER),
PRIMARY KEY (EMAIL_LIST_ID)
);
CREATE TABLE AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAILLIST_DETAILS_CONST UNIQUE (EMAIL_LIST_ID,EMAIL)
);
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher');
-- AM Throttling tables --
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_POLICY_SUBSCRIPTION]') AND TYPE IN (N'U'))
CREATE TABLE AM_POLICY_SUBSCRIPTION (
POLICY_ID INTEGER IDENTITY(1,1),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
RATE_LIMIT_COUNT INTEGER NULL DEFAULT NULL,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
IS_DEPLOYED BIT NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES VARBINARY(MAX) DEFAULT NULL,
STOP_ON_QUOTA_REACH BIT NOT NULL DEFAULT 0,
BILLING_PLAN VARCHAR(20) NOT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_POLICY_APPLICATION]') AND TYPE IN (N'U'))
CREATE TABLE AM_POLICY_APPLICATION (
POLICY_ID INTEGER IDENTITY(1,1),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED BIT NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES VARBINARY(MAX) DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_POLICY_HARD_THROTTLING]') AND TYPE IN (N'U'))
CREATE TABLE AM_POLICY_HARD_THROTTLING (
POLICY_ID INTEGER IDENTITY(1,1),
NAME VARCHAR(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED BIT NOT NULL DEFAULT 0,
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID)
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_THROTTLE_POLICY]') AND TYPE IN (N'U'))
CREATE TABLE AM_API_THROTTLE_POLICY (
POLICY_ID INTEGER IDENTITY(1,1),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR (1024),
DEFAULT_QUOTA_TYPE VARCHAR(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR(25) NOT NULL,
IS_DEPLOYED BIT NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_CONDITION_GROUP]') AND TYPE IN (N'U'))
CREATE TABLE AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER IDENTITY(1,1),
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
DESCRIPTION VARCHAR (1024) NULL DEFAULT NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_QUERY_PARAMETER_CONDITION]') AND TYPE IN (N'U'))
CREATE TABLE AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER IDENTITY(1,1),
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR(255) DEFAULT NULL,
IS_PARAM_MAPPING BIT DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_HEADER_FIELD_CONDITION]') AND TYPE IN (N'U'))
CREATE TABLE AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER IDENTITY(1,1),
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING BIT DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_JWT_CLAIM_CONDITION]') AND TYPE IN (N'U'))
CREATE TABLE AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER IDENTITY(1,1),
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR(1024) DEFAULT NULL,
IS_CLAIM_MAPPING BIT DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_IP_CONDITION]') AND TYPE IN (N'U'))
CREATE TABLE AM_IP_CONDITION (
AM_IP_CONDITION_ID INTEGER IDENTITY(1,1),
STARTING_IP VARCHAR(45) NULL,
ENDING_IP VARCHAR(45) NULL,
SPECIFIC_IP VARCHAR(45) NULL,
WITHIN_IP_RANGE BIT DEFAULT 1,
CONDITION_GROUP_ID INT NULL,
PRIMARY KEY (AM_IP_CONDITION_ID),
FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_POLICY_GLOBAL]') AND TYPE IN (N'U'))
CREATE TABLE AM_POLICY_GLOBAL (
POLICY_ID INTEGER IDENTITY(1,1),
NAME VARCHAR(512) NOT NULL,
KEY_TEMPLATE VARCHAR(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
SIDDHI_QUERY VARBINARY(MAX) DEFAULT NULL,
IS_DEPLOYED BIT NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_THROTTLE_TIER_PERMISSIONS]') AND TYPE IN (N'U'))
CREATE TABLE AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INTEGER IDENTITY(1,1),
TIER VARCHAR(50) NULL,
PERMISSIONS_TYPE VARCHAR(50) NULL,
ROLES VARCHAR(512) NULL,
TENANT_ID INTEGER NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID));
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_BLOCK_CONDITIONS]') AND TYPE IN (N'U'))
CREATE TABLE AM_BLOCK_CONDITIONS (
CONDITION_ID INTEGER IDENTITY(1,1),
TYPE varchar(45) DEFAULT NULL,
VALUE varchar(45) DEFAULT NULL,
ENABLED varchar(45) DEFAULT NULL,
DOMAIN varchar(45) DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (CONDITION_ID),
UNIQUE (UUID)
);
-- End of API-MGT Tables --
--Permance indexes start--
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME);
create index IDX_IOAT_AT on IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN);
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE);
create index IDX_AAI_CTX on AM_API (CONTEXT);
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY);
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID);
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER);
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE);
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE);
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE);
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID);
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE);
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY);
-- Performance indexes end--

@ -18,6 +18,8 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR(128),
CALLBACK_URL VARCHAR(1024),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
)ENGINE INNODB;
@ -89,6 +91,8 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR(255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
@ -517,7 +521,7 @@ CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE (
DEVICE_DATA VARCHAR(2048) NOT NULL,
PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_REQUEST (
UUID VARCHAR (45),
CREATED_BY VARCHAR (255),
@ -532,8 +536,8 @@ CREATE TABLE IF NOT EXISTS WF_REQUEST (
CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE (
PROFILE_NAME VARCHAR(45),
HOST_URL_MANAGER VARCHAR(45),
HOST_URL_WORKER VARCHAR(45),
HOST_URL_MANAGER VARCHAR(255),
HOST_URL_WORKER VARCHAR(255),
USERNAME VARCHAR(45),
PASSWORD VARCHAR(255),
CALLBACK_HOST VARCHAR (45),
@ -627,7 +631,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION (
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP,
UUID VARCHAR(256),
UUID VARCHAR(254),
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY(APPLICATION_ID),
UNIQUE (NAME,SUBSCRIBER_ID),
@ -641,6 +645,7 @@ CREATE TABLE IF NOT EXISTS AM_API (
API_VERSION VARCHAR(30),
CONTEXT VARCHAR(256),
CONTEXT_TEMPLATE VARCHAR(256),
API_TIER VARCHAR(256),
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(100),
@ -672,7 +677,7 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION (
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP,
UUID VARCHAR(256),
UUID VARCHAR(254),
FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (SUBSCRIPTION_ID),
@ -682,7 +687,7 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION (
CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING (
SUBSCRIPTION_ID INTEGER,
ACCESS_TOKEN VARCHAR(255),
KEY_TYPE VARCHAR(512) NOT NULL,
KEY_TYPE VARCHAR(255) NOT NULL,
FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN)
)ENGINE INNODB;
@ -690,7 +695,7 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING (
CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING (
APPLICATION_ID INTEGER,
CONSUMER_KEY VARCHAR(255),
KEY_TYPE VARCHAR(512) NOT NULL,
KEY_TYPE VARCHAR(255) NOT NULL,
STATE VARCHAR(30) NOT NULL,
CREATE_MODE VARCHAR(30) DEFAULT 'CREATED',
FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
@ -789,17 +794,246 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION (
CREATE TABLE IF NOT EXISTS AM_API_SCOPES (
API_ID INTEGER NOT NULL,
SCOPE_ID INTEGER NOT NULL,
FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION (
DEFAULT_VERSION_ID INT AUTO_INCREMENT,
DEFAULT_VERSION_ID INT AUTO_INCREMENT,
API_NAME VARCHAR(256) NOT NULL ,
API_PROVIDER VARCHAR(256) NOT NULL ,
DEFAULT_API_VERSION VARCHAR(30) ,
API_PROVIDER VARCHAR(256) NOT NULL ,
DEFAULT_API_VERSION VARCHAR(30) ,
PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) ,
PRIMARY KEY (DEFAULT_VERSION_ID)
);
)ENGINE = INNODB;
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER AUTO_INCREMENT,
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONSTRAINT UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER AUTO_INCREMENT,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
PRIMARY KEY (EMAIL_LIST_ID),
CONSTRAINT AM_ALERT_EMAILLIST_CONSTRAINT UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAILLIST_DETAILS_CONSTRAINT UNIQUE (EMAIL_LIST_ID,EMAIL)
)ENGINE = INNODB;
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher');
-- AM Throttling tables --
CREATE TABLE IF NOT EXISTS AM_POLICY_SUBSCRIPTION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
RATE_LIMIT_COUNT INT(11) NULL DEFAULT NULL,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
STOP_ON_QUOTA_REACH BOOLEAN NOT NULL DEFAULT 0,
BILLING_PLAN VARCHAR(20) NOT NULL,
UUID VARCHAR(254),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX AM_POLICY_SUBSCRIPTION_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_APPLICATION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
UUID VARCHAR(254),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX APP_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_HARD_THROTTLING (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX POLICY_HARD_NAME_TENANT (NAME, TENANT_ID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_API_THROTTLE_POLICY (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR (1024),
DEFAULT_QUOTA_TYPE VARCHAR(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(254),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX API_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER NOT NULL AUTO_INCREMENT,
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
DESCRIPTION VARCHAR (1024) NULL DEFAULT NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR(255) DEFAULT NULL,
IS_PARAM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR(1024) DEFAULT NULL,
IS_CLAIM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_IP_CONDITION (
AM_IP_CONDITION_ID INT NOT NULL AUTO_INCREMENT,
STARTING_IP VARCHAR(45) NULL,
ENDING_IP VARCHAR(45) NULL,
SPECIFIC_IP VARCHAR(45) NULL,
WITHIN_IP_RANGE BOOLEAN DEFAULT 1,
CONDITION_GROUP_ID INT NULL,
PRIMARY KEY (AM_IP_CONDITION_ID),
INDEX fk_AM_IP_CONDITION_1_idx (CONDITION_GROUP_ID ASC), CONSTRAINT fk_AM_IP_CONDITION_1 FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE)
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_GLOBAL (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
KEY_TEMPLATE VARCHAR(512) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
SIDDHI_QUERY BLOB DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(254),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
CREATE TABLE IF NOT EXISTS AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INT NOT NULL AUTO_INCREMENT,
TIER VARCHAR(50) NULL,
PERMISSIONS_TYPE VARCHAR(50) NULL,
ROLES VARCHAR(512) NULL,
TENANT_ID INT(11) NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID))
ENGINE = InnoDB;
CREATE TABLE `AM_BLOCK_CONDITIONS` (
`CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT,
`TYPE` varchar(45) DEFAULT NULL,
`VALUE` varchar(45) DEFAULT NULL,
`ENABLED` varchar(45) DEFAULT NULL,
`DOMAIN` varchar(45) DEFAULT NULL,
`UUID` VARCHAR(254),
PRIMARY KEY (`CONDITION_ID`),
UNIQUE (`UUID`)
) ENGINE=InnoDB;
-- End of API-MGT Tables --
-- Performance indexes start--
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME);
create index IDX_IOAT_AT on IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN);
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE);
create index IDX_AAI_CTX on AM_API (CONTEXT);
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY);
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID);
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER);
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE);
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE);
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE);
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID);
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE);
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY);
-- Performance indexes end--

@ -24,6 +24,8 @@ CREATE TABLE IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR2 (128),
CALLBACK_URL VARCHAR2 (1024),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID))
/
@ -102,6 +104,8 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR (255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE)
/
@ -341,7 +345,7 @@ CREATE OR REPLACE TRIGGER SP_AUTH_STEP_TRIG
SELECT SP_AUTH_STEP_SEQ.nextval INTO :NEW.ID FROM dual;
END;
/
ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE
ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONST_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE
/
CREATE TABLE SP_FEDERATED_IDP (
ID INTEGER NOT NULL,
@ -436,7 +440,7 @@ CREATE OR REPLACE TRIGGER SP_PROV_CONNECTOR_TRIG
SELECT SP_PROV_CONNECTOR_SEQ.nextval INTO :NEW.ID FROM dual;
END;
/
ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE
ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONST FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE
/
CREATE TABLE IDP (
ID INTEGER,
@ -788,8 +792,8 @@ CREATE TABLE WF_REQUEST (
CREATE TABLE WF_BPS_PROFILE (
PROFILE_NAME VARCHAR2(45),
HOST_URL_MANAGER VARCHAR2(45),
HOST_URL_WORKER VARCHAR2(45),
HOST_URL_MANAGER VARCHAR2(255),
HOST_URL_WORKER VARCHAR2(255),
USERNAME VARCHAR2(45),
PASSWORD VARCHAR2(255),
CALLBACK_HOST VARCHAR2 (45),
@ -867,7 +871,7 @@ CREATE TABLE WF_WORKFLOW_REQUEST_RELATION(
-- End of IDENTITY Tables--
-- Start of API-MGT Tables--
CREATE TABLE AM_SUBSCRIBER (
CREATE TABLE AM_SUBSCRIBER (
SUBSCRIBER_ID INTEGER,
USER_ID VARCHAR2(50) NOT NULL,
TENANT_ID INTEGER NOT NULL,
@ -936,6 +940,7 @@ CREATE TABLE AM_API (
API_VERSION VARCHAR2(30),
CONTEXT VARCHAR2(256),
CONTEXT_TEMPLATE VARCHAR2(256),
API_TIER VARCHAR(256),
CREATED_BY VARCHAR2(100),
CREATED_TIME DATE,
UPDATED_BY VARCHAR2(100),
@ -1071,7 +1076,6 @@ CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING (
CONSUMER_KEY VARCHAR(255),
AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL',
PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN)
)
/
@ -1258,3 +1262,386 @@ CREATE OR REPLACE TRIGGER AM_API_DEFAULT_VERSION_TRG
/
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID)
/
CREATE TABLE AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER,
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID))
/
CREATE SEQUENCE AM_ALERT_TYPES_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER AM_ALERT_TYPES_TRIG
BEFORE INSERT
ON AM_ALERT_TYPES
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT AM_ALERT_TYPES_SEQ.nextval INTO :NEW.ALERT_TYPE_ID FROM dual;
END;
/
CREATE TABLE AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONST UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER))
/
CREATE TABLE AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_EMAILLIST_CONST UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER),
PRIMARY KEY (EMAIL_LIST_ID))
/
CREATE SEQUENCE AM_ALERT_EMAILLIST_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER AM_ALERT_EMAILLIST_TRIG
BEFORE INSERT
ON AM_ALERT_EMAILLIST
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT AM_ALERT_EMAILLIST_SEQ.nextval INTO :NEW.EMAIL_LIST_ID FROM dual;
END;
/
CREATE TABLE AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAIL_LIST_DET_CONST UNIQUE (EMAIL_LIST_ID,EMAIL))
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher')
/
-- AM Throttling tables --
CREATE TABLE AM_POLICY_SUBSCRIPTION (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
QUOTA_TYPE VARCHAR2(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
RATE_LIMIT_COUNT INTEGER DEFAULT NULL NULL,
RATE_LIMIT_TIME_UNIT VARCHAR2(25) DEFAULT NULL NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
STOP_ON_QUOTA_REACH INTEGER DEFAULT 0 NOT NULL,
BILLING_PLAN VARCHAR2(20),
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT SUBSCRIPTION_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_SUBSCRIPTION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_POLICY_SUBSCRIPTION_seq_tr
BEFORE INSERT ON AM_POLICY_SUBSCRIPTION FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_SUBSCRIPTION_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_POLICY_APPLICATION (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
QUOTA_TYPE VARCHAR2(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) DEFAULT NULL NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT AM_POLICY_APP_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_APPLICATION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_POLICY_APPLICATION_seq_tr
BEFORE INSERT ON AM_POLICY_APPLICATION FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_APPLICATION_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_API_THROTTLE_POLICY (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2 (1024),
DEFAULT_QUOTA_TYPE VARCHAR2(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR2(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR2(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR2(25) NOT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT API_POLICY_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_API_THROTTLE_POLICY_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_API_THROTTLE_POLICY_seq_tr
BEFORE INSERT ON AM_API_THROTTLE_POLICY FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_API_THROTTLE_POLICY_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER NOT NULL,
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR2(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) DEFAULT NULL NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_CONDITION_GROUP_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_CONDITION_GROUP_seq_tr
BEFORE INSERT ON AM_CONDITION_GROUP FOR EACH ROW
WHEN (NEW.CONDITION_GROUP_ID IS NULL)
BEGIN
SELECT AM_CONDITION_GROUP_seq.NEXTVAL INTO :NEW.CONDITION_GROUP_ID FROM DUAL;
END;
/
CREATE TABLE AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR2(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR2(255) DEFAULT NULL,
IS_PARAM_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE QUERY_PARAMETER_CONDITION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER QUERY_PARAMETER_CONDITION_tr
BEFORE INSERT ON AM_QUERY_PARAMETER_CONDITION FOR EACH ROW
WHEN (NEW.QUERY_PARAMETER_ID IS NULL)
BEGIN
SELECT QUERY_PARAMETER_CONDITION_seq.NEXTVAL INTO :NEW.QUERY_PARAMETER_ID FROM DUAL;
END;
/
CREATE TABLE AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR2(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR2(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_HEADER_FIELD_CONDITION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_HEADER_FIELD_CONDITION_tr
BEFORE INSERT ON AM_HEADER_FIELD_CONDITION FOR EACH ROW
WHEN (NEW.HEADER_FIELD_ID IS NULL)
BEGIN
SELECT AM_HEADER_FIELD_CONDITION_seq.NEXTVAL INTO :NEW.HEADER_FIELD_ID FROM DUAL;
END;
/
CREATE TABLE AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR2(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR2(1024) DEFAULT NULL,
IS_CLAIM_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_JWT_CLAIM_CONDITION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_JWT_CLAIM_CONDITION_seq_tr
BEFORE INSERT ON AM_JWT_CLAIM_CONDITION FOR EACH ROW
WHEN (NEW.JWT_CLAIM_ID IS NULL)
BEGIN
SELECT AM_JWT_CLAIM_CONDITION_seq.NEXTVAL INTO :NEW.JWT_CLAIM_ID FROM DUAL;
END;
/
CREATE TABLE AM_IP_CONDITION (
AM_IP_CONDITION_ID INTEGER NOT NULL,
STARTING_IP VARCHAR2(45) NULL,
ENDING_IP VARCHAR2(45) NULL,
SPECIFIC_IP VARCHAR2(45) NULL,
WITHIN_IP_RANGE CHAR(1) DEFAULT 1,
CONDITION_GROUP_ID INTEGER NULL,
PRIMARY KEY (AM_IP_CONDITION_ID)
, CONSTRAINT fk_AM_IP_CONDITION_1 FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE )
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_IP_CONDITION_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_IP_CONDITION_seq_tr
BEFORE INSERT ON AM_IP_CONDITION FOR EACH ROW
WHEN (NEW.AM_IP_CONDITION_ID IS NULL)
BEGIN
SELECT AM_IP_CONDITION_seq.NEXTVAL INTO :NEW.AM_IP_CONDITION_ID FROM DUAL;
END;
/
CREATE INDEX fk_AM_IP_CONDITION_1_idx ON AM_IP_CONDITION (CONDITION_GROUP_ID ASC)
/
CREATE TABLE AM_POLICY_GLOBAL (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
KEY_TEMPLATE VARCHAR2(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
SIDDHI_QUERY BLOB DEFAULT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_GLOBAL_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_POLICY_GLOBAL_seq_tr
BEFORE INSERT ON AM_POLICY_GLOBAL FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_GLOBAL_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INTEGER NOT NULL,
TIER VARCHAR2(50) NULL,
PERMISSIONS_TYPE VARCHAR2(50) NULL,
ROLES VARCHAR2(512) NULL,
TENANT_ID INTEGER NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID))
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE THROTTLE_TIER_PERMISSIONS_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER THROTTLE_TIER_PERMISSIONS_tr
BEFORE INSERT ON AM_THROTTLE_TIER_PERMISSIONS FOR EACH ROW
WHEN (NEW.THROTTLE_TIER_PERMISSIONS_ID IS NULL)
BEGIN
SELECT THROTTLE_TIER_PERMISSIONS_seq.NEXTVAL INTO :NEW.THROTTLE_TIER_PERMISSIONS_ID FROM DUAL;
END;
/
CREATE TABLE AM_BLOCK_CONDITIONS (
CONDITION_ID INTEGER NOT NULL,
TYPE varchar2(45) DEFAULT NULL,
VALUE varchar2(45) DEFAULT NULL,
ENABLED varchar2(45) DEFAULT NULL,
DOMAIN varchar2(45) DEFAULT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (CONDITION_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_BLOCK_CONDITIONS_seq START WITH 1 INCREMENT BY 1
/
CREATE OR REPLACE TRIGGER AM_BLOCK_CONDITIONS_seq_tr
BEFORE INSERT ON AM_BLOCK_CONDITIONS FOR EACH ROW
WHEN (NEW.CONDITION_ID IS NULL)
BEGIN
SELECT AM_BLOCK_CONDITIONS_seq.NEXTVAL INTO :NEW.CONDITION_ID FROM DUAL;
END;
/
-- End of API-MGT Tables --
--permance indexes start--
/
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME)
/
create index IDX_IOAT_AT on IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN)
/
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE)
/
create index IDX_AAI_CTX on AM_API (CONTEXT)
/
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY)
/
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID)
/
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER)
/
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE)
/
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE)
/
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE)
/
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID)
/
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE)
/
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY)
/
-- Performance indexes end--

@ -23,6 +23,8 @@ CREATE TABLE IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR2 (128),
CALLBACK_URL VARCHAR2 (1024),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID))
/
@ -101,6 +103,8 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR (255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE)
/
@ -471,6 +475,7 @@ CREATE OR REPLACE TRIGGER IDP_TRIG
SELECT IDP_SEQ.nextval INTO :NEW.ID FROM dual;
END;
/
INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost')
/
CREATE TABLE IDP_ROLE (
@ -784,8 +789,8 @@ CREATE TABLE WF_REQUEST (
CREATE TABLE WF_BPS_PROFILE (
PROFILE_NAME VARCHAR2(45),
HOST_URL_MANAGER VARCHAR2(45),
HOST_URL_WORKER VARCHAR2(45),
HOST_URL_MANAGER VARCHAR2(255),
HOST_URL_WORKER VARCHAR2(255),
USERNAME VARCHAR2(45),
PASSWORD VARCHAR2(255),
CALLBACK_HOST VARCHAR2 (45),
@ -933,6 +938,7 @@ CREATE TABLE AM_API (
API_VERSION VARCHAR2(30),
CONTEXT VARCHAR2(256),
CONTEXT_TEMPLATE VARCHAR2(256),
API_TIER VARCHAR(256),
CREATED_BY VARCHAR2(100),
CREATED_TIME DATE,
UPDATED_BY VARCHAR2(100),
@ -1255,3 +1261,387 @@ CREATE OR REPLACE TRIGGER AM_API_DEFAULT_VERSION_TRG
/
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID)
/
CREATE TABLE AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER,
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID))
/
CREATE SEQUENCE AM_ALERT_TYPES_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER AM_ALERT_TYPES_TRIG
BEFORE INSERT
ON AM_ALERT_TYPES
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT AM_ALERT_TYPES_SEQ.nextval INTO :NEW.ALERT_TYPE_ID FROM dual;
END;
/
CREATE TABLE AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONST UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER))
/
CREATE TABLE AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_EMAILLIST_CONST UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER),
PRIMARY KEY (EMAIL_LIST_ID))
/
CREATE SEQUENCE AM_ALERT_EMAILLIST_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER AM_ALERT_EMAILLIST_TRIG
BEFORE INSERT
ON AM_ALERT_EMAILLIST
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT AM_ALERT_EMAILLIST_SEQ.nextval INTO :NEW.EMAIL_LIST_ID FROM dual;
END;
/
CREATE TABLE AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAIL_LIST_DET_CONST UNIQUE (EMAIL_LIST_ID,EMAIL))
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher')
/
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher')
/
-- AM Throttling tables --
CREATE TABLE AM_POLICY_SUBSCRIPTION (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
QUOTA_TYPE VARCHAR2(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
RATE_LIMIT_COUNT INTEGER DEFAULT NULL NULL,
RATE_LIMIT_TIME_UNIT VARCHAR2(25) DEFAULT NULL NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
STOP_ON_QUOTA_REACH INTEGER DEFAULT 0 NOT NULL,
BILLING_PLAN VARCHAR2(20),
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT SUBSCRIPTION_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_SUBSCRIPTION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_POLICY_SUBSCRIPTION_seq_tr
BEFORE INSERT ON AM_POLICY_SUBSCRIPTION FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_SUBSCRIPTION_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_POLICY_APPLICATION (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
QUOTA_TYPE VARCHAR2(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) DEFAULT NULL NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT AM_POLICY_APP_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_APPLICATION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_POLICY_APPLICATION_seq_tr
BEFORE INSERT ON AM_POLICY_APPLICATION FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_APPLICATION_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_API_THROTTLE_POLICY (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
DISPLAY_NAME VARCHAR2(512) DEFAULT NULL NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2 (1024),
DEFAULT_QUOTA_TYPE VARCHAR2(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR2(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR2(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR2(25) NOT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
CONSTRAINT API_POLICY_NAME_TENANT UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_API_THROTTLE_POLICY_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_API_THROTTLE_POLICY_seq_tr
BEFORE INSERT ON AM_API_THROTTLE_POLICY FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_API_THROTTLE_POLICY_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER NOT NULL,
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR2(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR2(10) DEFAULT NULL NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR2(25) NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_CONDITION_GROUP_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_CONDITION_GROUP_seq_tr
BEFORE INSERT ON AM_CONDITION_GROUP FOR EACH ROW
WHEN (NEW.CONDITION_GROUP_ID IS NULL)
BEGIN
SELECT AM_CONDITION_GROUP_seq.NEXTVAL INTO :NEW.CONDITION_GROUP_ID FROM DUAL;
END;
/
CREATE TABLE AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR2(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR2(255) DEFAULT NULL,
IS_PARAM_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE QUERY_PARAMETER_CONDITION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER QUERY_PARAMETER_CONDITION_tr
BEFORE INSERT ON AM_QUERY_PARAMETER_CONDITION FOR EACH ROW
WHEN (NEW.QUERY_PARAMETER_ID IS NULL)
BEGIN
SELECT AM_QUERY_PARAMETER_CONDITION_seq.NEXTVAL INTO :NEW.QUERY_PARAMETER_ID FROM DUAL;
END;
/
CREATE TABLE AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR2(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR2(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_HEADER_FIELD_CONDITION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_HEADER_FIELD_CONDITION_tr
BEFORE INSERT ON AM_HEADER_FIELD_CONDITION FOR EACH ROW
WHEN (NEW.HEADER_FIELD_ID IS NULL)
BEGIN
SELECT AM_HEADER_FIELD_CONDITION_seq.NEXTVAL INTO :NEW.HEADER_FIELD_ID FROM DUAL;
END;
/
CREATE TABLE AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER NOT NULL,
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR2(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR2(1024) DEFAULT NULL,
IS_CLAIM_MAPPING CHAR(1) DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_JWT_CLAIM_CONDITION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_JWT_CLAIM_CONDITION_seq_tr
BEFORE INSERT ON AM_JWT_CLAIM_CONDITION FOR EACH ROW
WHEN (NEW.JWT_CLAIM_ID IS NULL)
BEGIN
SELECT AM_JWT_CLAIM_CONDITION_seq.NEXTVAL INTO :NEW.JWT_CLAIM_ID FROM DUAL;
END;
/
CREATE TABLE AM_IP_CONDITION (
AM_IP_CONDITION_ID INTEGER NOT NULL,
STARTING_IP VARCHAR2(45) NULL,
ENDING_IP VARCHAR2(45) NULL,
SPECIFIC_IP VARCHAR2(45) NULL,
WITHIN_IP_RANGE CHAR(1) DEFAULT 1,
CONDITION_GROUP_ID INTEGER NULL,
PRIMARY KEY (AM_IP_CONDITION_ID)
, CONSTRAINT fk_AM_IP_CONDITION_1 FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE )
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_IP_CONDITION_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_IP_CONDITION_seq_tr
BEFORE INSERT ON AM_IP_CONDITION FOR EACH ROW
WHEN (NEW.AM_IP_CONDITION_ID IS NULL)
BEGIN
SELECT AM_IP_CONDITION_seq.NEXTVAL INTO :NEW.AM_IP_CONDITION_ID FROM DUAL;
END;
/
CREATE INDEX fk_AM_IP_CONDITION_1_idx ON AM_IP_CONDITION (CONDITION_GROUP_ID ASC)
/
CREATE TABLE AM_POLICY_GLOBAL (
POLICY_ID INTEGER NOT NULL,
NAME VARCHAR2(512) NOT NULL,
KEY_TEMPLATE VARCHAR2(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR2(1024) DEFAULT NULL NULL,
SIDDHI_QUERY BLOB DEFAULT NULL,
IS_DEPLOYED INTEGER DEFAULT 0 NOT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_POLICY_GLOBAL_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_POLICY_GLOBAL_seq_tr
BEFORE INSERT ON AM_POLICY_GLOBAL FOR EACH ROW
WHEN (NEW.POLICY_ID IS NULL)
BEGIN
SELECT AM_POLICY_GLOBAL_seq.NEXTVAL INTO :NEW.POLICY_ID FROM DUAL;
END;
/
CREATE TABLE AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INTEGER NOT NULL,
TIER VARCHAR2(50) NULL,
PERMISSIONS_TYPE VARCHAR2(50) NULL,
ROLES VARCHAR2(512) NULL,
TENANT_ID INTEGER NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID))
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE THROTTLE_TIER_PERMISSIONS_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER THROTTLE_TIER_PERMISSIONS_tr
BEFORE INSERT ON AM_THROTTLE_TIER_PERMISSIONS FOR EACH ROW
WHEN (NEW.THROTTLE_TIER_PERMISSIONS_ID IS NULL)
BEGIN
SELECT THROTTLE_TIER_PERMISSIONS_seq.NEXTVAL INTO :NEW.THROTTLE_TIER_PERMISSIONS_ID FROM DUAL;
END;
/
CREATE TABLE AM_BLOCK_CONDITIONS (
CONDITION_ID INTEGER NOT NULL,
TYPE varchar2(45) DEFAULT NULL,
VALUE varchar2(45) DEFAULT NULL,
ENABLED varchar2(45) DEFAULT NULL,
DOMAIN varchar2(45) DEFAULT NULL,
UUID VARCHAR2(256),
PRIMARY KEY (CONDITION_ID),
UNIQUE (UUID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE AM_BLOCK_CONDITIONS_seq START WITH 1 INCREMENT BY 1 CACHE 20 ORDER
/
CREATE OR REPLACE TRIGGER AM_BLOCK_CONDITIONS_seq_tr
BEFORE INSERT ON AM_BLOCK_CONDITIONS FOR EACH ROW
WHEN (NEW.CONDITION_ID IS NULL)
BEGIN
SELECT AM_BLOCK_CONDITIONS_seq.NEXTVAL INTO :NEW.CONDITION_ID FROM DUAL;
END;
/
-- End of API-MGT Tables --
--permance indexes start--
/
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME)
/
create index IDX_IOAT_AT on IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN)
/
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE)
/
create index IDX_AAI_CTX on AM_API (CONTEXT)
/
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY)
/
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID)
/
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER)
/
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE)
/
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE)
/
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE)
/
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID)
/
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE)
/
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY)
/
-- Performance indexes end--

@ -23,6 +23,8 @@ CREATE TABLE IDN_OAUTH_CONSUMER_APPS (
OAUTH_VERSION VARCHAR(128),
CALLBACK_URL VARCHAR(1024),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
);
@ -98,6 +100,8 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR (255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
);
@ -388,10 +392,11 @@ CREATE TABLE IDP (
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, NAME));
INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost');
DROP TABLE IF EXISTS IDP_ROLE;
DROP SEQUENCE IF EXISTS IDP_ROLE_SEQ;
INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost');
CREATE SEQUENCE IDP_ROLE_SEQ;
CREATE TABLE IDP_ROLE (
ID INTEGER DEFAULT NEXTVAL('IDP_ROLE_SEQ'),
@ -604,13 +609,11 @@ CREATE TABLE WF_REQUEST (
DROP TABLE IF EXISTS WF_BPS_PROFILE;
CREATE TABLE WF_BPS_PROFILE (
PROFILE_NAME VARCHAR(45),
HOST_URL_MANAGER VARCHAR(45),
HOST_URL_WORKER VARCHAR(45),
HOST_URL_MANAGER VARCHAR(255),
HOST_URL_WORKER VARCHAR(255),
USERNAME VARCHAR(45),
PASSWORD VARCHAR(255),
CALLBACK_HOST VARCHAR (45),
CALLBACK_USERNAME VARCHAR (45),
CALLBACK_PASSWORD VARCHAR (255),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (PROFILE_NAME, TENANT_ID)
);
@ -679,7 +682,7 @@ CREATE TABLE WF_WORKFLOW_REQUEST_RELATION(
-- End of IDENTITY Tables--
CREATE SEQUENCE AM_SUBSCRIBER_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_SUBSCRIBER (
CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER (
SUBSCRIBER_ID INTEGER DEFAULT nextval('am_subscriber_sequence'),
USER_ID VARCHAR(50) NOT NULL,
TENANT_ID INTEGER NOT NULL,
@ -695,7 +698,7 @@ CREATE TABLE AM_SUBSCRIBER (
;
CREATE SEQUENCE AM_APPLICATION_SEQUENCE START WITH 1 INCREMENT BY 1 ;
CREATE TABLE AM_APPLICATION (
CREATE TABLE IF NOT EXISTS AM_APPLICATION (
APPLICATION_ID INTEGER DEFAULT nextval('am_application_sequence'),
NAME VARCHAR(100),
SUBSCRIBER_ID INTEGER,
@ -717,24 +720,24 @@ CREATE TABLE AM_APPLICATION (
;
CREATE SEQUENCE AM_API_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_API (
CREATE TABLE IF NOT EXISTS AM_API (
API_ID INTEGER DEFAULT nextval('am_api_sequence'),
API_PROVIDER VARCHAR(256),
API_NAME VARCHAR(256),
API_VERSION VARCHAR(30),
CONTEXT VARCHAR(256),
CONTEXT_TEMPLATE VARCHAR(256),
API_TIER VARCHAR(256),
CREATED_BY VARCHAR(100),
CREATED_TIME DATE,
UPDATED_BY VARCHAR(100),
UPDATED_TIME DATE,
PRIMARY KEY(API_ID),
UNIQUE (API_PROVIDER,API_NAME,API_VERSION)
)
;
);
CREATE SEQUENCE AM_API_URL_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_API_URL_MAPPING (
CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING (
URL_MAPPING_ID INTEGER DEFAULT nextval('am_api_url_mapping_sequence'),
API_ID INTEGER NOT NULL,
HTTP_METHOD VARCHAR(20) NULL,
@ -747,7 +750,7 @@ CREATE TABLE AM_API_URL_MAPPING (
;
CREATE SEQUENCE AM_SUBSCRIPTION_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_SUBSCRIPTION (
CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION (
SUBSCRIPTION_ID INTEGER DEFAULT nextval('am_subscription_sequence'),
TIER_ID VARCHAR(50),
API_ID INTEGER,
@ -767,7 +770,7 @@ CREATE TABLE AM_SUBSCRIPTION (
)
;
CREATE TABLE AM_SUBSCRIPTION_KEY_MAPPING (
CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING (
SUBSCRIPTION_ID INTEGER,
ACCESS_TOKEN VARCHAR(512),
KEY_TYPE VARCHAR(512) NOT NULL,
@ -808,7 +811,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION (
CREATE SEQUENCE AM_API_LC_EVENT_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_API_LC_EVENT (
CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT (
EVENT_ID INTEGER DEFAULT nextval('am_api_lc_event_sequence'),
API_ID INTEGER NOT NULL,
PREVIOUS_STATE VARCHAR(50),
@ -821,7 +824,7 @@ CREATE TABLE AM_API_LC_EVENT (
)
;
CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING (
CREATE TABLE IF NOT EXISTS AM_APP_KEY_DOMAIN_MAPPING (
CONSUMER_KEY VARCHAR(255),
AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL',
PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN)
@ -829,7 +832,7 @@ CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING (
;
CREATE SEQUENCE AM_API_COMMENTS_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_API_COMMENTS (
CREATE TABLE IF NOT EXISTS AM_API_COMMENTS (
COMMENT_ID INTEGER DEFAULT nextval('am_api_comments_sequence'),
COMMENT_TEXT VARCHAR(512),
COMMENTED_USER VARCHAR(255),
@ -841,7 +844,7 @@ CREATE TABLE AM_API_COMMENTS (
;
CREATE SEQUENCE AM_WORKFLOWS_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_WORKFLOWS(
CREATE TABLE IF NOT EXISTS AM_WORKFLOWS(
WF_ID INTEGER DEFAULT nextval('am_workflows_sequence'),
WF_REFERENCE VARCHAR(255) NOT NULL,
WF_TYPE VARCHAR(255) NOT NULL,
@ -858,7 +861,7 @@ CREATE TABLE AM_WORKFLOWS(
;
CREATE SEQUENCE AM_API_RATINGS_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_API_RATINGS (
CREATE TABLE IF NOT EXISTS AM_API_RATINGS (
RATING_ID INTEGER DEFAULT nextval('am_api_ratings_sequence'),
API_ID INTEGER,
RATING INTEGER,
@ -870,7 +873,7 @@ CREATE TABLE AM_API_RATINGS (
;
CREATE SEQUENCE AM_TIER_PERMISSIONS_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_TIER_PERMISSIONS (
CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS (
TIER_PERMISSIONS_ID INTEGER DEFAULT nextval('am_tier_permissions_sequence'),
TIER VARCHAR(50) NOT NULL,
PERMISSIONS_TYPE VARCHAR(50) NOT NULL,
@ -880,7 +883,7 @@ CREATE TABLE AM_TIER_PERMISSIONS (
);
CREATE SEQUENCE AM_EXTERNAL_STORES_SEQUENCE START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_EXTERNAL_STORES (
CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES (
APISTORE_ID INTEGER DEFAULT nextval('am_external_stores_sequence'),
API_ID INTEGER,
STORE_ID VARCHAR(255) NOT NULL,
@ -892,7 +895,7 @@ CREATE TABLE AM_EXTERNAL_STORES (
)
;
DROP TABLE IF EXISTS AM_API_SCOPES;
CREATE TABLE IF NOT EXISTS AM_API_SCOPES (
API_ID INTEGER NOT NULL,
SCOPE_ID INTEGER NOT NULL,
@ -900,10 +903,9 @@ CREATE TABLE IF NOT EXISTS AM_API_SCOPES (
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
DROP TABLE IF EXISTS AM_API_DEFAULT_VERSION;
DROP SEQUENCE IF EXISTS AM_API_DEFAULT_VERSION_PK_SEQ;
CREATE SEQUENCE AM_API_DEFAULT_VERSION_PK_SEQ;
CREATE TABLE AM_API_DEFAULT_VERSION (
CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION (
DEFAULT_VERSION_ID INTEGER DEFAULT NEXTVAL('am_api_default_version_pk_seq'),
API_NAME VARCHAR(256) NOT NULL ,
API_PROVIDER VARCHAR(256) NOT NULL ,
@ -915,4 +917,246 @@ CREATE TABLE AM_API_DEFAULT_VERSION (
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID)
;
commit;
CREATE SEQUENCE AM_ALERT_TYPES_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER DEFAULT NEXTVAL('am_alert_types_seq'),
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID)
);
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_TYPES_VALUES_CONST UNIQUE (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)
);
CREATE SEQUENCE AM_ALERT_EMAILLIST_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER DEFAULT NEXTVAL('am_alert_emaillist_seq'),
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
CONSTRAINT AM_ALERT_EMAILLIST_CONST UNIQUE (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER),
PRIMARY KEY (EMAIL_LIST_ID)
);
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
CONSTRAINT AM_ALERT_EMAILLIST_DETAILS_CONST UNIQUE (EMAIL_LIST_ID,EMAIL)
);
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalResponseTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalBackendTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('abnormalRequestsPerMin', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('RequestPatternChanged', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccessAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRefreshAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierHittingAlert', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalTierUsage', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('healthAvailabilityPerMin', 'publisher');
-- AM Throttling tables --
CREATE SEQUENCE AM_POLICY_SUBSCRIPTION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_POLICY_SUBSCRIPTION (
POLICY_ID INTEGER DEFAULT NEXTVAL('AM_POLICY_SUBSCRIPTION_SEQ'),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
RATE_LIMIT_COUNT INTEGER NULL DEFAULT NULL,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
IS_DEPLOYED BOOLEAN NOT NULL DEFAULT '0',
CUSTOM_ATTRIBUTES BYTEA DEFAULT NULL,
STOP_ON_QUOTA_REACH BOOLEAN NOT NULL DEFAULT '0',
BILLING_PLAN VARCHAR(20) NOT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE SEQUENCE AM_POLICY_APPLICATION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_POLICY_APPLICATION (
POLICY_ID INTEGER DEFAULT NEXTVAL('AM_POLICY_APPLICATION_SEQ'),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED BOOLEAN NOT NULL DEFAULT '0',
CUSTOM_ATTRIBUTES BYTEA DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE SEQUENCE AM_POLICY_HARD_THROTTLING_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_POLICY_HARD_THROTTLING (
POLICY_ID INTEGER DEFAULT NEXTVAL('AM_POLICY_HARD_THROTTLING_SEQ'),
NAME VARCHAR(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED BOOLEAN NOT NULL DEFAULT '0',
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID)
);
CREATE SEQUENCE AM_API_THROTTLE_POLICY_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_API_THROTTLE_POLICY (
POLICY_ID INTEGER DEFAULT NEXTVAL('AM_API_THROTTLE_POLICY_SEQ'),
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR (1024),
DEFAULT_QUOTA_TYPE VARCHAR(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR(25) NOT NULL,
IS_DEPLOYED BOOLEAN NOT NULL DEFAULT '0',
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (NAME, TENANT_ID),
UNIQUE (UUID)
);
CREATE SEQUENCE AM_CONDITION_GROUP_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER DEFAULT NEXTVAL('AM_CONDITION_GROUP_SEQ'),
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
DESCRIPTION VARCHAR (1024) NULL DEFAULT NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE SEQUENCE AM_QUERY_PARAMETER_CONDITION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER DEFAULT NEXTVAL('AM_QUERY_PARAMETER_CONDITION_SEQ'),
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR(255) DEFAULT NULL,
IS_PARAM_MAPPING BOOLEAN DEFAULT '1',
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE SEQUENCE AM_HEADER_FIELD_CONDITION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER DEFAULT NEXTVAL('AM_HEADER_FIELD_CONDITION_SEQ'),
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING BOOLEAN DEFAULT '1',
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE SEQUENCE AM_JWT_CLAIM_CONDITION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER DEFAULT NEXTVAL('AM_JWT_CLAIM_CONDITION_SEQ'),
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR(1024) DEFAULT NULL,
IS_CLAIM_MAPPING BOOLEAN DEFAULT '1',
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE SEQUENCE AM_IP_CONDITION_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_IP_CONDITION (
AM_IP_CONDITION_ID INTEGER DEFAULT NEXTVAL('AM_IP_CONDITION_SEQ'),
STARTING_IP VARCHAR(45) NULL,
ENDING_IP VARCHAR(45) NULL,
SPECIFIC_IP VARCHAR(45) NULL,
WITHIN_IP_RANGE BOOLEAN DEFAULT '1',
CONDITION_GROUP_ID INT NULL,
PRIMARY KEY (AM_IP_CONDITION_ID),
FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE);
CREATE SEQUENCE AM_POLICY_GLOBAL_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_POLICY_GLOBAL (
POLICY_ID INTEGER DEFAULT NEXTVAL('AM_POLICY_GLOBAL_SEQ'),
NAME VARCHAR(512) NOT NULL,
KEY_TEMPLATE VARCHAR(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
SIDDHI_QUERY BYTEA DEFAULT NULL,
IS_DEPLOYED BOOLEAN NOT NULL DEFAULT '0',
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
);
CREATE SEQUENCE AM_THROTTLE_TIER_PERMISSIONS_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INTEGER DEFAULT NEXTVAL('AM_THROTTLE_TIER_PERMISSIONS_SEQ'),
TIER VARCHAR(50) NULL,
PERMISSIONS_TYPE VARCHAR(50) NULL,
ROLES VARCHAR(512) NULL,
TENANT_ID INTEGER NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID));
CREATE SEQUENCE AM_BLOCK_CONDITIONS_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE AM_BLOCK_CONDITIONS (
CONDITION_ID INTEGER DEFAULT NEXTVAL('AM_BLOCK_CONDITIONS_SEQ'),
TYPE varchar(45) DEFAULT NULL,
VALUE varchar(45) DEFAULT NULL,
ENABLED varchar(45) DEFAULT NULL,
DOMAIN varchar(45) DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (CONDITION_ID),
UNIQUE (UUID)
);
-- End of API-MGT Tables --
-- Performance indexes start--
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME);
create index IDX_IOAT_AT on IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN);
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE);
create index IDX_AAI_CTX on AM_API (CONTEXT);
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY);
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID);
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER);
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE);
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE);
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE);
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID);
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE);
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY);
-- Performance indexes end--
commit;

Loading…
Cancel
Save