|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|