apiVersion: v1
data:
  init.sql: "DROP DATABASE IF EXISTS WSO2AM_MGW_ANALYTICS_DB;\n    DROP DATABASE IF
    EXISTS WSO2AM_APIMGT_DB;\n    DROP DATABASE IF EXISTS WSO2AM_STATS_DB;\n    DROP
    DATABASE IF EXISTS PERMISSION_DB;\n    DROP DATABASE IF EXISTS WSO2AM_BUSINESS_RULES_DB;\n
    \   DROP DATABASE IF EXISTS WSO2AM_SHARED_DB;\n    CREATE DATABASE WSO2AM_MGW_ANALYTICS_DB;\n
    \   CREATE DATABASE WSO2AM_APIMGT_DB;\n    CREATE DATABASE WSO2AM_STATS_DB;\n
    \   CREATE DATABASE PERMISSION_DB;\n    CREATE DATABASE WSO2AM_BUSINESS_RULES_DB;\n
    \   CREATE DATABASE WSO2AM_SHARED_DB;\n    CREATE USER IF NOT EXISTS 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON WSO2AM_MGW_ANALYTICS_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON WSO2AM_APIMGT_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON WSO2AM_STATS_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON PERMISSION_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON WSO2AM_BUSINESS_RULES_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    GRANT ALL ON WSO2AM_SHARED_DB.* TO 'wso2carbon'@'%'
    IDENTIFIED BY 'wso2carbon';\n    USE WSO2AM_STATS_DB;\n    -- Start of IDENTITY
    Tables--\n    CREATE TABLE IF NOT EXISTS AM_USAGE_UPLOADED_FILES (\n    FILE_NAME
    varchar(255) NOT NULL,\n    FILE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n
    \   FILE_PROCESSED tinyint(1) DEFAULT 0,\n    FILE_CONTENT MEDIUMBLOB DEFAULT
    NULL,\n    PRIMARY KEY (FILE_NAME, FILE_TIMESTAMP)\n    );\n    USE WSO2AM_MGW_ANALYTICS_DB;\n
    \   -- Start of IDENTITY Tables--\n    CREATE TABLE IF NOT EXISTS AM_USAGE_UPLOADED_FILES
    (\n    FILE_NAME varchar(255) NOT NULL,\n    FILE_TIMESTAMP TIMESTAMP DEFAULT
    CURRENT_TIMESTAMP,\n    FILE_PROCESSED tinyint(1) DEFAULT 0,\n    FILE_CONTENT
    MEDIUMBLOB DEFAULT NULL,\n    PRIMARY KEY (FILE_NAME, FILE_TIMESTAMP)\n    );\n
    \   USE WSO2AM_SHARED_DB;\n    CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (\n
    \                REG_LOCK_NAME VARCHAR (20),\n                 REG_LOCK_STATUS
    VARCHAR (20),\n                 REG_LOCKED_TIME TIMESTAMP,\n                 REG_TENANT_ID
    INTEGER DEFAULT 0,\n                 PRIMARY KEY (REG_LOCK_NAME)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS REG_LOG (\n                 REG_LOG_ID
    INTEGER AUTO_INCREMENT,\n                 REG_PATH VARCHAR (750),\n                 REG_USER_ID
    VARCHAR (31) NOT NULL,\n                 REG_LOGGED_TIME TIMESTAMP NOT NULL,\n
    \                REG_ACTION INTEGER NOT NULL,\n                 REG_ACTION_DATA
    VARCHAR (500),\n                 REG_TENANT_ID INTEGER DEFAULT 0,\n                 PRIMARY
    KEY (REG_LOG_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE INDEX REG_LOG_IND_BY_REGLOG
    USING HASH ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID);\n    -- The REG_PATH_VALUE
    should be less than 767 bytes, and hence was fixed at 750.\n    -- See CARBON-5917.\n
    \   CREATE TABLE IF NOT EXISTS REG_PATH(\n                 REG_PATH_ID INTEGER
    NOT NULL AUTO_INCREMENT,\n                 REG_PATH_VALUE VARCHAR(750) NOT NULL,\n
    \                REG_PATH_PARENT_ID INTEGER,\n                 REG_TENANT_ID INTEGER
    DEFAULT 0,\n                 CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID),\n
    \                CONSTRAINT UNIQUE_REG_PATH_TENANT_ID UNIQUE (REG_PATH_VALUE,REG_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE INDEX REG_PATH_IND_BY_PATH_VALUE USING HASH ON
    REG_PATH(REG_PATH_VALUE, REG_TENANT_ID);\n    CREATE INDEX REG_PATH_IND_BY_PATH_PARENT_ID
    USING HASH ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID);\n    CREATE TABLE IF
    NOT EXISTS REG_CONTENT (\n                 REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \                REG_CONTENT_DATA LONGBLOB,\n                 REG_TENANT_ID INTEGER
    DEFAULT 0,\n                 CONSTRAINT PK_REG_CONTENT PRIMARY KEY(REG_CONTENT_ID,
    REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY
    (\n                 REG_CONTENT_ID INTEGER NOT NULL,\n                 REG_CONTENT_DATA
    LONGBLOB,\n                 REG_DELETED   SMALLINT,\n                 REG_TENANT_ID
    INTEGER DEFAULT 0,\n                 CONSTRAINT PK_REG_CONTENT_HISTORY PRIMARY
    KEY(REG_CONTENT_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS REG_RESOURCE (\n                REG_PATH_ID         INTEGER NOT NULL,\n
    \               REG_NAME            VARCHAR(256),\n                REG_VERSION
    \        INTEGER NOT NULL AUTO_INCREMENT,\n                REG_MEDIA_TYPE      VARCHAR(500),\n
    \               REG_CREATOR         VARCHAR(31) NOT NULL,\n                REG_CREATED_TIME
    \   TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                REG_LAST_UPDATOR
    \   VARCHAR(31),\n                REG_LAST_UPDATED_TIME    TIMESTAMP NOT NULL
    DEFAULT CURRENT_TIMESTAMP,\n                REG_DESCRIPTION     VARCHAR(1000),\n
    \               REG_CONTENT_ID      INTEGER,\n                REG_TENANT_ID INTEGER
    DEFAULT 0,\n                REG_UUID VARCHAR(100) NOT NULL,\n                CONSTRAINT
    PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID)\n    )ENGINE INNODB;\n
    \   ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_PATH_ID FOREIGN
    KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n
    \   ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN
    KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_IND_BY_NAME USING HASH ON REG_RESOURCE(REG_NAME,
    REG_TENANT_ID);\n    CREATE INDEX REG_RESOURCE_IND_BY_PATH_ID_NAME USING HASH
    ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);\n    CREATE INDEX REG_RESOURCE_IND_BY_UUID
    USING HASH ON REG_RESOURCE(REG_UUID);\n    CREATE INDEX REG_RESOURCE_IND_BY_TENAN
    USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);\n    CREATE INDEX REG_RESOURCE_IND_BY_TYPE
    USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);\n    CREATE TABLE IF
    NOT EXISTS REG_RESOURCE_HISTORY (\n                REG_PATH_ID         INTEGER
    NOT NULL,\n                REG_NAME            VARCHAR(256),\n                REG_VERSION
    \        INTEGER NOT NULL,\n                REG_MEDIA_TYPE      VARCHAR(500),\n
    \               REG_CREATOR         VARCHAR(31) NOT NULL,\n                REG_CREATED_TIME
    \   TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                REG_LAST_UPDATOR
    \   VARCHAR(31),\n                REG_LAST_UPDATED_TIME    TIMESTAMP NOT NULL
    DEFAULT CURRENT_TIMESTAMP,\n                REG_DESCRIPTION     VARCHAR(1000),\n
    \               REG_CONTENT_ID      INTEGER,\n                REG_DELETED         SMALLINT,\n
    \               REG_TENANT_ID INTEGER DEFAULT 0,\n                REG_UUID VARCHAR(100)
    NOT NULL,\n                CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION,
    REG_TENANT_ID)\n    )ENGINE INNODB;\n    ALTER TABLE REG_RESOURCE_HISTORY ADD
    CONSTRAINT REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID)
    REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n    ALTER TABLE REG_RESOURCE_HISTORY
    ADD CONSTRAINT REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID,
    REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_NAME USING HASH ON REG_RESOURCE_HISTORY(REG_NAME,
    REG_TENANT_ID);\n    CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME USING
    HASH ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);\n    CREATE TABLE
    IF NOT EXISTS REG_COMMENT (\n                REG_ID        INTEGER NOT NULL AUTO_INCREMENT,\n
    \               REG_COMMENT_TEXT      VARCHAR(500) NOT NULL,\n                REG_USER_ID
    \          VARCHAR(31) NOT NULL,\n                REG_COMMENTED_TIME    TIMESTAMP
    NOT NULL,\n                REG_TENANT_ID INTEGER DEFAULT 0,\n                CONSTRAINT
    PK_REG_COMMENT PRIMARY KEY(REG_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS REG_RESOURCE_COMMENT (\n                REG_COMMENT_ID          INTEGER
    NOT NULL,\n                REG_VERSION             INTEGER,\n                REG_PATH_ID
    \            INTEGER,\n                REG_RESOURCE_NAME       VARCHAR(256),\n
    \               REG_TENANT_ID INTEGER DEFAULT 0\n    )ENGINE INNODB;\n    ALTER
    TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN
    KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n
    \   ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID
    FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH
    ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);\n    CREATE
    INDEX REG_RESOURCE_COMMENT_IND_BY_VERSION USING HASH ON REG_RESOURCE_COMMENT(REG_VERSION,
    REG_TENANT_ID);\n    CREATE TABLE IF NOT EXISTS REG_RATING (\n                REG_ID
    \    INTEGER NOT NULL AUTO_INCREMENT,\n                REG_RATING        INTEGER
    NOT NULL,\n                REG_USER_ID       VARCHAR(31) NOT NULL,\n                REG_RATED_TIME
    \   TIMESTAMP NOT NULL,\n                REG_TENANT_ID INTEGER DEFAULT 0,\n                CONSTRAINT
    PK_REG_RATING PRIMARY KEY(REG_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS REG_RESOURCE_RATING (\n                REG_RATING_ID           INTEGER
    NOT NULL,\n                REG_VERSION             INTEGER,\n                REG_PATH_ID
    \            INTEGER,\n                REG_RESOURCE_NAME       VARCHAR(256),\n
    \               REG_TENANT_ID INTEGER DEFAULT 0\n    )ENGINE INNODB;\n    ALTER
    TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN
    KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n
    \   ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_RATING_ID
    FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH
    ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);\n    CREATE
    INDEX REG_RESOURCE_RATING_IND_BY_VERSION USING HASH ON REG_RESOURCE_RATING(REG_VERSION,
    REG_TENANT_ID);\n    CREATE TABLE IF NOT EXISTS REG_TAG (\n                REG_ID
    \        INTEGER NOT NULL AUTO_INCREMENT,\n                REG_TAG_NAME       VARCHAR(500)
    NOT NULL,\n                REG_USER_ID        VARCHAR(31) NOT NULL,\n                REG_TAGGED_TIME
    \   TIMESTAMP NOT NULL,\n                REG_TENANT_ID INTEGER DEFAULT 0,\n                CONSTRAINT
    PK_REG_TAG PRIMARY KEY(REG_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS REG_RESOURCE_TAG (\n                REG_TAG_ID              INTEGER
    NOT NULL,\n                REG_VERSION             INTEGER,\n                REG_PATH_ID
    \            INTEGER,\n                REG_RESOURCE_NAME       VARCHAR(256),\n
    \               REG_TENANT_ID INTEGER DEFAULT 0\n    )ENGINE INNODB;\n    ALTER
    TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY
    (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n
    \   ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_TAG_ID
    FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH
    ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);\n    CREATE
    INDEX REG_RESOURCE_TAG_IND_BY_VERSION USING HASH ON REG_RESOURCE_TAG(REG_VERSION,
    REG_TENANT_ID);\n    CREATE TABLE IF NOT EXISTS REG_PROPERTY (\n                REG_ID
    \        INTEGER NOT NULL AUTO_INCREMENT,\n                REG_NAME       VARCHAR(100)
    NOT NULL,\n                REG_VALUE        VARCHAR(1000),\n                REG_TENANT_ID
    INTEGER DEFAULT 0,\n                CONSTRAINT PK_REG_PROPERTY PRIMARY KEY(REG_ID,
    REG_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY
    (\n                REG_PROPERTY_ID         INTEGER NOT NULL,\n                REG_VERSION
    \            INTEGER,\n                REG_PATH_ID             INTEGER,\n                REG_RESOURCE_NAME
    \      VARCHAR(256),\n                REG_TENANT_ID INTEGER DEFAULT 0\n    )ENGINE
    INNODB;\n    ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_PATH_ID
    FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n
    \   ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_TAG_ID
    FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID,
    REG_TENANT_ID);\n    CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME
    USING HASH ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);\n
    \   CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PROPERTY(REG_VERSION,
    REG_TENANT_ID);\n    -- CREATE TABLE IF NOT EXISTS REG_ASSOCIATIONS (\n    --
    SRC_PATH_ID     INTEGER,\n    -- SRC_RESOURCE_NAME    VARCHAR(256),\n    -- SRC_VERSION
    \    INTEGER,\n    -- TGT_PATH_ID     INTEGER,\n    -- TGT_RESOURCE_NAME    VARCHAR(256),\n
    \   -- TGT_VERSION     INTEGER\n    -- )ENGINE INNODB;\n    --\n    -- ALTER TABLE
    REG_ASSOCIATIONS ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_SRC_PATH_ID FOREIGN KEY
    (SRC_PATH_ID) REFERENCES REG_PATH (PATH_ID);\n    -- ALTER TABLE REG_ASSOCIATIONS
    ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_TGT_PATH_ID FOREIGN KEY (TGT_PATH_ID) REFERENCES
    REG_PATH (PATH_ID);\n    -- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_VERSION ON
    REG_ASSOCIATIONS(SRC_VERSION);\n    -- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_VERSION
    ON REG_ASSOCIATIONS(TGT_VERSION);\n    -- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_RESOURCE_NAME
    ON REG_ASSOCIATIONS(SRC_RESOURCE_NAME);\n    -- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_RESOURCE_NAME
    ON REG_ASSOCIATIONS(TGT_RESOURCE_NAME);\n    CREATE TABLE IF NOT EXISTS REG_ASSOCIATION
    (\n                REG_ASSOCIATION_ID INTEGER AUTO_INCREMENT,\n                REG_SOURCEPATH
    VARCHAR (750) NOT NULL,\n                REG_TARGETPATH VARCHAR (750) NOT NULL,\n
    \               REG_ASSOCIATION_TYPE VARCHAR (2000) NOT NULL,\n                REG_TENANT_ID
    INTEGER DEFAULT 0,\n                PRIMARY KEY (REG_ASSOCIATION_ID, REG_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS REG_SNAPSHOT (\n                REG_SNAPSHOT_ID
    \    INTEGER NOT NULL AUTO_INCREMENT,\n                REG_PATH_ID            INTEGER
    NOT NULL,\n                REG_RESOURCE_NAME      VARCHAR(255),\n                REG_RESOURCE_VIDS
    \    LONGBLOB NOT NULL,\n                REG_TENANT_ID INTEGER DEFAULT 0,\n                CONSTRAINT
    PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID)\n    )ENGINE INNODB;\n
    \   CREATE INDEX REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_SNAPSHOT(REG_PATH_ID,
    REG_RESOURCE_NAME, REG_TENANT_ID);\n    ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT
    REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES
    REG_PATH (REG_PATH_ID, REG_TENANT_ID);\n    -- ################################\n
    \   -- USER MANAGER TABLES\n    -- ################################\n    CREATE
    TABLE UM_TENANT (\n    \t\t\tUM_ID INTEGER NOT NULL AUTO_INCREMENT,\n    \t        UM_DOMAIN_NAME
    VARCHAR(255) NOT NULL,\n                UM_EMAIL VARCHAR(255),\n                UM_ACTIVE
    BOOLEAN DEFAULT FALSE,\n    \t        UM_CREATED_DATE TIMESTAMP NOT NULL,\n    \t
    \       UM_USER_CONFIG LONGBLOB,\n    \t\t\tPRIMARY KEY (UM_ID),\n    \t\t\tUNIQUE(UM_DOMAIN_NAME)\n
    \   )ENGINE INNODB;\n    CREATE TABLE UM_DOMAIN(\n                UM_DOMAIN_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                UM_DOMAIN_NAME VARCHAR(255)
    NOT NULL,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n                PRIMARY
    KEY (UM_DOMAIN_ID, UM_TENANT_ID),\n                UNIQUE(UM_DOMAIN_NAME,UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE UNIQUE INDEX INDEX_UM_TENANT_UM_DOMAIN_NAME\n
    \                       ON UM_TENANT (UM_DOMAIN_NAME);\n    CREATE TABLE UM_USER
    (\n                 UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n                 UM_USER_NAME
    VARCHAR(255) NOT NULL,\n                 UM_USER_PASSWORD VARCHAR(255) NOT NULL,\n
    \                UM_SALT_VALUE VARCHAR(31),\n                 UM_REQUIRE_CHANGE
    BOOLEAN DEFAULT FALSE,\n                 UM_CHANGED_TIME TIMESTAMP NOT NULL,\n
    \                UM_TENANT_ID INTEGER DEFAULT 0,\n                 PRIMARY KEY
    (UM_ID, UM_TENANT_ID),\n                 UNIQUE(UM_USER_NAME, UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE UM_SYSTEM_USER (\n                 UM_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                 UM_USER_NAME VARCHAR(255) NOT
    NULL,\n                 UM_USER_PASSWORD VARCHAR(255) NOT NULL,\n                 UM_SALT_VALUE
    VARCHAR(31),\n                 UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,\n                 UM_CHANGED_TIME
    TIMESTAMP NOT NULL,\n                 UM_TENANT_ID INTEGER DEFAULT 0,\n                 PRIMARY
    KEY (UM_ID, UM_TENANT_ID),\n                 UNIQUE(UM_USER_NAME, UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE UM_ROLE (\n                 UM_ID INTEGER
    NOT NULL AUTO_INCREMENT,\n                 UM_ROLE_NAME VARCHAR(255) NOT NULL,\n
    \                UM_TENANT_ID INTEGER DEFAULT 0,\n    \t\tUM_SHARED_ROLE BOOLEAN
    DEFAULT FALSE,\n                 PRIMARY KEY (UM_ID, UM_TENANT_ID),\n                 UNIQUE(UM_ROLE_NAME,
    UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_MODULE(\n    \tUM_ID INTEGER
    \ NOT NULL AUTO_INCREMENT,\n    \tUM_MODULE_NAME VARCHAR(100),\n    \tUNIQUE(UM_MODULE_NAME),\n
    \   \tPRIMARY KEY(UM_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_MODULE_ACTIONS(\n
    \   \tUM_ACTION VARCHAR(255) NOT NULL,\n    \tUM_MODULE_ID INTEGER NOT NULL,\n
    \   \tPRIMARY KEY(UM_ACTION, UM_MODULE_ID),\n    \tFOREIGN KEY (UM_MODULE_ID)
    REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE
    TABLE UM_PERMISSION (\n                 UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \                UM_RESOURCE_ID VARCHAR(255) NOT NULL,\n                 UM_ACTION
    VARCHAR(255) NOT NULL,\n                 UM_TENANT_ID INTEGER DEFAULT 0,\n    \t\tUM_MODULE_ID
    INTEGER DEFAULT 0,\n    \t\t\t       UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID),\n
    \                PRIMARY KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE
    INDEX INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID,
    UM_ACTION, UM_TENANT_ID);\n    CREATE TABLE UM_ROLE_PERMISSION (\n                 UM_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                 UM_PERMISSION_ID INTEGER NOT
    NULL,\n                 UM_ROLE_NAME VARCHAR(255) NOT NULL,\n                 UM_IS_ALLOWED
    SMALLINT NOT NULL,\n                 UM_TENANT_ID INTEGER DEFAULT 0,\n    \t     UM_DOMAIN_ID
    INTEGER,\n                 UNIQUE (UM_PERMISSION_ID, UM_ROLE_NAME, UM_TENANT_ID,
    UM_DOMAIN_ID),\n    \t     FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES
    UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,\n    \t     FOREIGN KEY
    (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID)
    ON DELETE CASCADE,\n                 PRIMARY KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE
    INNODB;\n    -- REMOVED UNIQUE (UM_PERMISSION_ID, UM_ROLE_ID)\n    CREATE TABLE
    UM_USER_PERMISSION (\n                 UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \                UM_PERMISSION_ID INTEGER NOT NULL,\n                 UM_USER_NAME
    VARCHAR(255) NOT NULL,\n                 UM_IS_ALLOWED SMALLINT NOT NULL,\n                 UM_TENANT_ID
    INTEGER DEFAULT 0,\n                 FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID)
    REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,\n                 PRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    -- REMOVED UNIQUE (UM_PERMISSION_ID,
    UM_USER_ID)\n    CREATE TABLE UM_USER_ROLE (\n                 UM_ID INTEGER NOT
    NULL AUTO_INCREMENT,\n                 UM_ROLE_ID INTEGER NOT NULL,\n                 UM_USER_ID
    INTEGER NOT NULL,\n                 UM_TENANT_ID INTEGER DEFAULT 0,\n                 UNIQUE
    (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID),\n                 FOREIGN KEY (UM_ROLE_ID,
    UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID),\n                 FOREIGN
    KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID),\n                 PRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_SHARED_USER_ROLE(\n
    \       UM_ROLE_ID INTEGER NOT NULL,\n        UM_USER_ID INTEGER NOT NULL,\n        UM_USER_TENANT_ID
    INTEGER NOT NULL,\n        UM_ROLE_TENANT_ID INTEGER NOT NULL,\n        UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID,
    UM_ROLE_TENANT_ID),\n        FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES
    UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE,\n        FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID)
    REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n
    \   CREATE TABLE UM_ACCOUNT_MAPPING(\n    \tUM_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \   \tUM_USER_NAME VARCHAR(255) NOT NULL,\n    \tUM_TENANT_ID INTEGER NOT NULL,\n
    \   \tUM_USER_STORE_DOMAIN VARCHAR(100),\n    \tUM_ACC_LINK_ID INTEGER NOT NULL,\n
    \   \tUNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),\n
    \   \tFOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,\n
    \   \tPRIMARY KEY (UM_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_USER_ATTRIBUTE
    (\n                UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n                UM_ATTR_NAME
    VARCHAR(255) NOT NULL,\n                UM_ATTR_VALUE VARCHAR(1024),\n                UM_PROFILE_ID
    VARCHAR(255),\n                UM_USER_ID INTEGER,\n                UM_TENANT_ID
    INTEGER DEFAULT 0,\n                FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES
    UM_USER(UM_ID, UM_TENANT_ID),\n                PRIMARY KEY (UM_ID, UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE INDEX UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID);\n
    \   CREATE TABLE UM_DIALECT(\n                UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \               UM_DIALECT_URI VARCHAR(255) NOT NULL,\n                UM_TENANT_ID
    INTEGER DEFAULT 0,\n                UNIQUE(UM_DIALECT_URI, UM_TENANT_ID),\n                PRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_CLAIM(\n                UM_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                UM_DIALECT_ID INTEGER NOT NULL,\n
    \               UM_CLAIM_URI VARCHAR(255) NOT NULL,\n                UM_DISPLAY_TAG
    VARCHAR(255),\n                UM_DESCRIPTION VARCHAR(255),\n                UM_MAPPED_ATTRIBUTE_DOMAIN
    VARCHAR(255),\n                UM_MAPPED_ATTRIBUTE VARCHAR(255),\n                UM_REG_EX
    VARCHAR(255),\n                UM_SUPPORTED SMALLINT,\n                UM_REQUIRED
    SMALLINT,\n                UM_DISPLAY_ORDER INTEGER,\n    \t    UM_CHECKED_ATTRIBUTE
    SMALLINT,\n                UM_READ_ONLY SMALLINT,\n                UM_TENANT_ID
    INTEGER DEFAULT 0,\n                UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI, UM_TENANT_ID,UM_MAPPED_ATTRIBUTE_DOMAIN),\n
    \               FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID,
    UM_TENANT_ID),\n                PRIMARY KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE UM_PROFILE_CONFIG(\n                UM_ID INTEGER NOT
    NULL AUTO_INCREMENT,\n                UM_DIALECT_ID INTEGER NOT NULL,\n                UM_PROFILE_NAME
    VARCHAR(255),\n                UM_TENANT_ID INTEGER DEFAULT 0,\n                FOREIGN
    KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),\n
    \               PRIMARY KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS UM_CLAIM_BEHAVIOR(\n        UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \       UM_PROFILE_ID INTEGER,\n        UM_CLAIM_ID INTEGER,\n        UM_BEHAVIOUR
    SMALLINT,\n        UM_TENANT_ID INTEGER DEFAULT 0,\n        FOREIGN KEY(UM_PROFILE_ID,
    UM_TENANT_ID) REFERENCES UM_PROFILE_CONFIG(UM_ID,UM_TENANT_ID),\n        FOREIGN
    KEY(UM_CLAIM_ID, UM_TENANT_ID) REFERENCES UM_CLAIM(UM_ID,UM_TENANT_ID),\n        PRIMARY
    KEY(UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_HYBRID_ROLE(\n
    \               UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n                UM_ROLE_NAME
    VARCHAR(255) NOT NULL,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n                PRIMARY
    KEY (UM_ID, UM_TENANT_ID),\n                UNIQUE(UM_ROLE_NAME,UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE INDEX UM_ROLE_NAME_IND ON UM_HYBRID_ROLE(UM_ROLE_NAME);\n
    \   CREATE TABLE UM_HYBRID_USER_ROLE(\n                UM_ID INTEGER NOT NULL
    AUTO_INCREMENT,\n                UM_USER_NAME VARCHAR(255),\n                UM_ROLE_ID
    INTEGER NOT NULL,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n    \t    UM_DOMAIN_ID
    INTEGER,\n                UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID),\n
    \               FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID,
    UM_TENANT_ID) ON DELETE CASCADE,\n    \t    FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID)
    REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,\n                PRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_SYSTEM_ROLE(\n
    \               UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n                UM_ROLE_NAME
    VARCHAR(255) NOT NULL,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n                PRIMARY
    KEY (UM_ID, UM_TENANT_ID),\n                UNIQUE(UM_ROLE_NAME,UM_TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE INDEX SYSTEM_ROLE_IND_BY_RN_TI ON UM_SYSTEM_ROLE(UM_ROLE_NAME,
    UM_TENANT_ID);\n    CREATE TABLE UM_SYSTEM_USER_ROLE(\n                UM_ID INTEGER
    NOT NULL AUTO_INCREMENT,\n                UM_USER_NAME VARCHAR(255),\n                UM_ROLE_ID
    INTEGER NOT NULL,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n                UNIQUE
    (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),\n                FOREIGN KEY (UM_ROLE_ID,
    UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),\n                PRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE UM_HYBRID_REMEMBER_ME(\n
    \               UM_ID INTEGER NOT NULL AUTO_INCREMENT,\n    \t\t\tUM_USER_NAME
    VARCHAR(255) NOT NULL,\n    \t\t\tUM_COOKIE_VALUE VARCHAR(1024),\n    \t\t\tUM_CREATED_TIME
    TIMESTAMP,\n                UM_TENANT_ID INTEGER DEFAULT 0,\n    \t\t\tPRIMARY
    KEY (UM_ID, UM_TENANT_ID)\n    )ENGINE INNODB;\n    USE WSO2AM_APIMGT_DB;\n    --
    Start of IDENTITY Tables--\n    CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE (\n
    \               PRODUCT_NAME VARCHAR(20),\n                PRIMARY KEY (PRODUCT_NAME)\n
    \   )ENGINE INNODB;\n    INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server');\n
    \   CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS (\n                ID INTEGER
    NOT NULL AUTO_INCREMENT,\n                CONSUMER_KEY VARCHAR(255),\n                CONSUMER_SECRET
    VARCHAR(2048),\n                USERNAME VARCHAR(255),\n                TENANT_ID
    INTEGER DEFAULT 0,\n                USER_DOMAIN VARCHAR(50),\n                APP_NAME
    VARCHAR(255),\n                OAUTH_VERSION VARCHAR(128),\n                CALLBACK_URL
    VARCHAR(2048),\n                GRANT_TYPES VARCHAR (1024),\n                PKCE_MANDATORY
    CHAR(1) DEFAULT '0',\n                PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',\n
    \               APP_STATE VARCHAR (25) DEFAULT 'ACTIVE',\n                USER_ACCESS_TOKEN_EXPIRE_TIME
    BIGINT DEFAULT 3600,\n                APP_ACCESS_TOKEN_EXPIRE_TIME BIGINT DEFAULT
    3600,\n                REFRESH_TOKEN_EXPIRE_TIME BIGINT DEFAULT 84600,\n                ID_TOKEN_EXPIRE_TIME
    BIGINT DEFAULT 3600,\n                CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE
    (CONSUMER_KEY),\n                PRIMARY KEY (ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_VALIDATORS (\n    \tAPP_ID INTEGER NOT NULL,\n
    \   \tSCOPE_VALIDATOR VARCHAR (128) NOT NULL,\n    \tPRIMARY KEY (APP_ID,SCOPE_VALIDATOR),\n
    \   \tFOREIGN KEY (APP_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN
    (\n                REQUEST_TOKEN VARCHAR(255),\n                REQUEST_TOKEN_SECRET
    VARCHAR(512),\n                CONSUMER_KEY_ID INTEGER,\n                CALLBACK_URL
    VARCHAR(2048),\n                SCOPE VARCHAR(2048),\n                AUTHORIZED
    VARCHAR(128),\n                OAUTH_VERIFIER VARCHAR(512),\n                AUTHZ_USER
    VARCHAR(512),\n                TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY
    KEY (REQUEST_TOKEN),\n                FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES
    IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN (\n                ACCESS_TOKEN VARCHAR(255),\n
    \               ACCESS_TOKEN_SECRET VARCHAR(512),\n                CONSUMER_KEY_ID
    INTEGER,\n                SCOPE VARCHAR(2048),\n                AUTHZ_USER VARCHAR(512),\n
    \               TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY KEY (ACCESS_TOKEN),\n
    \               FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID)
    ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN
    (\n                TOKEN_ID VARCHAR (255),\n                ACCESS_TOKEN VARCHAR(2048),\n
    \               REFRESH_TOKEN VARCHAR(2048),\n                CONSUMER_KEY_ID
    INTEGER,\n                AUTHZ_USER VARCHAR (100),\n                TENANT_ID
    INTEGER,\n                USER_DOMAIN VARCHAR(50),\n                USER_TYPE
    VARCHAR (25),\n                GRANT_TYPE VARCHAR (50),\n                TIME_CREATED
    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                REFRESH_TOKEN_TIME_CREATED
    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                VALIDITY_PERIOD
    BIGINT,\n                REFRESH_TOKEN_VALIDITY_PERIOD BIGINT,\n                TOKEN_SCOPE_HASH
    VARCHAR(32),\n                TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE',\n                TOKEN_STATE_ID
    VARCHAR (128) DEFAULT 'NONE',\n                SUBJECT_IDENTIFIER VARCHAR(255),\n
    \               ACCESS_TOKEN_HASH VARCHAR(512),\n                REFRESH_TOKEN_HASH
    VARCHAR(512),\n                IDP_ID INTEGER,\n                PRIMARY KEY (TOKEN_ID),\n
    \               FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID)
    ON DELETE CASCADE,\n                CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH,\n
    \                                              TOKEN_STATE,TOKEN_STATE_ID,IDP_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_AUDIT
    (\n                TOKEN_ID VARCHAR (255),\n                ACCESS_TOKEN VARCHAR(2048),\n
    \               REFRESH_TOKEN VARCHAR(2048),\n                CONSUMER_KEY_ID
    INTEGER,\n                AUTHZ_USER VARCHAR (100),\n                TENANT_ID
    INTEGER,\n                USER_DOMAIN VARCHAR(50),\n                USER_TYPE
    VARCHAR (25),\n                GRANT_TYPE VARCHAR (50),\n                TIME_CREATED
    TIMESTAMP NULL,\n                REFRESH_TOKEN_TIME_CREATED TIMESTAMP NULL,\n
    \               VALIDITY_PERIOD BIGINT,\n                REFRESH_TOKEN_VALIDITY_PERIOD
    BIGINT,\n                TOKEN_SCOPE_HASH VARCHAR(32),\n                TOKEN_STATE
    VARCHAR(25),\n                TOKEN_STATE_ID VARCHAR (128) ,\n                SUBJECT_IDENTIFIER
    VARCHAR(255),\n                ACCESS_TOKEN_HASH VARCHAR(512),\n                REFRESH_TOKEN_HASH
    VARCHAR(512),\n                INVALIDATED_TIME TIMESTAMP NULL,\n                IDP_ID
    INTEGER\n    );\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE
    (\n                CODE_ID VARCHAR (255),\n                AUTHORIZATION_CODE
    VARCHAR(2048),\n                CONSUMER_KEY_ID INTEGER,\n                CALLBACK_URL
    VARCHAR(2048),\n                SCOPE VARCHAR(2048),\n                AUTHZ_USER
    VARCHAR (100),\n                TENANT_ID INTEGER,\n                USER_DOMAIN
    VARCHAR(50),\n                TIME_CREATED TIMESTAMP,\n                VALIDITY_PERIOD
    BIGINT,\n                STATE VARCHAR (25) DEFAULT 'ACTIVE',\n                TOKEN_ID
    VARCHAR(255),\n                SUBJECT_IDENTIFIER VARCHAR(255),\n                PKCE_CODE_CHALLENGE
    VARCHAR(255),\n                PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),\n                AUTHORIZATION_CODE_HASH
    VARCHAR(512),\n                IDP_ID INTEGER,\n                PRIMARY KEY (CODE_ID),\n
    \               FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID)
    ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE
    (\n                TOKEN_ID VARCHAR (255),\n                TOKEN_SCOPE VARCHAR
    (60),\n                TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY
    KEY (TOKEN_ID, TOKEN_SCOPE),\n                FOREIGN KEY (TOKEN_ID) REFERENCES
    IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE (\n                SCOPE_ID INTEGER NOT NULL
    AUTO_INCREMENT,\n                NAME VARCHAR(255) NOT NULL,\n                DISPLAY_NAME
    VARCHAR(255) NOT NULL,\n                DESCRIPTION VARCHAR(512),\n                TENANT_ID
    INTEGER NOT NULL DEFAULT -1,\n                PRIMARY KEY (SCOPE_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_BINDING (\n                SCOPE_ID
    INTEGER NOT NULL,\n                SCOPE_BINDING VARCHAR(255),\n                FOREIGN
    KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE(SCOPE_ID) ON DELETE CASCADE\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE (\n                RESOURCE_PATH
    VARCHAR(255) NOT NULL,\n                SCOPE_ID INTEGER NOT NULL,\n                TENANT_ID
    INTEGER DEFAULT -1,\n                PRIMARY KEY (RESOURCE_PATH),\n                FOREIGN
    KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP (\n                ID INTEGER
    AUTO_INCREMENT,\n                TENANT_ID INTEGER NOT NULL,\n                ROLE_NAME
    VARCHAR(255) NOT NULL,\n                ATTR_NAME VARCHAR(1024) NOT NULL,\n                ATTR_VALUE
    VARCHAR(1024),\n                PRIMARY KEY (ID)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME (\n                USER_NAME VARCHAR(255)
    NOT NULL,\n                TENANT_ID INTEGER DEFAULT 0,\n                COOKIE_VALUE
    VARCHAR(1024),\n                CREATED_TIME TIMESTAMP,\n                PRIMARY
    KEY (USER_NAME, TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    IDN_OPENID_USER_RPS (\n                USER_NAME VARCHAR(255) NOT NULL,\n                TENANT_ID
    INTEGER DEFAULT 0,\n                RP_URL VARCHAR(255) NOT NULL,\n                TRUSTED_ALWAYS
    VARCHAR(128) DEFAULT 'FALSE',\n                LAST_VISIT DATE NOT NULL,\n                VISIT_COUNT
    INTEGER DEFAULT 0,\n                DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT
    'DEFAULT',\n                PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS (\n                HANDLE
    VARCHAR(255) NOT NULL,\n                ASSOC_TYPE VARCHAR(255) NOT NULL,\n                EXPIRE_IN
    TIMESTAMP NOT NULL,\n                MAC_KEY VARCHAR(255) NOT NULL,\n                ASSOC_STORE
    VARCHAR(128) DEFAULT 'SHARED',\n                TENANT_ID INTEGER DEFAULT -1,\n
    \               PRIMARY KEY (HANDLE)\n    )ENGINE INNODB;\n    CREATE TABLE IF
    NOT EXISTS IDN_STS_STORE (\n                ID INTEGER AUTO_INCREMENT,\n                TOKEN_ID
    VARCHAR(255) NOT NULL,\n                TOKEN_CONTENT BLOB(1024) NOT NULL,\n                CREATE_DATE
    TIMESTAMP NOT NULL,\n                EXPIRE_DATE TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n
    \               STATE INTEGER DEFAULT 0,\n                PRIMARY KEY (ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_IDENTITY_USER_DATA (\n                TENANT_ID
    INTEGER DEFAULT -1234,\n                USER_NAME VARCHAR(255) NOT NULL,\n                DATA_KEY
    VARCHAR(255) NOT NULL,\n                DATA_VALUE VARCHAR(2048),\n                PRIMARY
    KEY (TENANT_ID, USER_NAME, DATA_KEY)\n    )ENGINE INNODB;\n    CREATE TABLE IF
    NOT EXISTS IDN_IDENTITY_META_DATA (\n                USER_NAME VARCHAR(255) NOT
    NULL,\n                TENANT_ID INTEGER DEFAULT -1234,\n                METADATA_TYPE
    VARCHAR(255) NOT NULL,\n                METADATA VARCHAR(255) NOT NULL,\n                VALID
    VARCHAR(255) NOT NULL,\n                PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION (\n                SESSION_ID
    VARCHAR(255) NOT NULL,\n                USER_NAME VARCHAR(255) NOT NULL,\n                CREATED_TIME
    VARCHAR(255) NOT NULL,\n                LAST_MODIFIED_TIME VARCHAR(255) NOT NULL,\n
    \               TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY KEY (SESSION_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_STORE (\n
    \               SESSION_ID VARCHAR (100) NOT NULL,\n                SESSION_TYPE
    VARCHAR(100) NOT NULL,\n                OPERATION VARCHAR(10) NOT NULL,\n                SESSION_OBJECT
    BLOB,\n                TIME_CREATED BIGINT,\n                TENANT_ID INTEGER
    DEFAULT -1,\n                EXPIRY_TIME BIGINT,\n                PRIMARY KEY
    (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_AUTH_TEMP_SESSION_STORE (\n                SESSION_ID
    VARCHAR (100) NOT NULL,\n                SESSION_TYPE VARCHAR(100) NOT NULL,\n
    \               OPERATION VARCHAR(10) NOT NULL,\n                SESSION_OBJECT
    BLOB,\n                TIME_CREATED BIGINT,\n                TENANT_ID INTEGER
    DEFAULT -1,\n                EXPIRY_TIME BIGINT,\n                PRIMARY KEY
    (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_AUTH_USER (\n                USER_ID VARCHAR(255) NOT
    NULL,\n                USER_NAME VARCHAR(255) NOT NULL,\n                TENANT_ID
    INTEGER NOT NULL,\n                DOMAIN_NAME VARCHAR(255) NOT NULL,\n                IDP_ID
    INTEGER NOT NULL,\n                PRIMARY KEY (USER_ID),\n                CONSTRAINT
    USER_STORE_CONSTRAINT UNIQUE (USER_NAME, TENANT_ID, DOMAIN_NAME, IDP_ID));\n    CREATE
    TABLE IF NOT EXISTS IDN_AUTH_USER_SESSION_MAPPING (\n                USER_ID VARCHAR(255)
    NOT NULL,\n                SESSION_ID VARCHAR(255) NOT NULL,\n                CONSTRAINT
    USER_SESSION_STORE_CONSTRAINT UNIQUE (USER_ID, SESSION_ID));\n    CREATE TABLE
    IF NOT EXISTS IDN_AUTH_SESSION_APP_INFO (\n                SESSION_ID VARCHAR
    (100) NOT NULL,\n                SUBJECT VARCHAR (100) NOT NULL,\n                APP_ID
    INTEGER NOT NULL,\n                INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL,\n
    \               PRIMARY KEY (SESSION_ID, SUBJECT, APP_ID, INBOUND_AUTH_TYPE)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_META_DATA
    (\n                SESSION_ID VARCHAR (100) NOT NULL,\n                PROPERTY_TYPE
    VARCHAR (100) NOT NULL,\n                VALUE VARCHAR (255) NOT NULL,\n                PRIMARY
    KEY (SESSION_ID, PROPERTY_TYPE, VALUE)\n    )ENGINE INNODB;\n    CREATE TABLE
    IF NOT EXISTS SP_APP (\n            ID INTEGER NOT NULL AUTO_INCREMENT,\n            TENANT_ID
    INTEGER NOT NULL,\n    \t    \tAPP_NAME VARCHAR (255) NOT NULL ,\n    \t    \tUSER_STORE
    VARCHAR (255) NOT NULL,\n            USERNAME VARCHAR (255) NOT NULL ,\n            DESCRIPTION
    VARCHAR (1024),\n    \t    \tROLE_CLAIM VARCHAR (512),\n            AUTH_TYPE
    VARCHAR (255) NOT NULL,\n    \t    \tPROVISIONING_USERSTORE_DOMAIN VARCHAR (512),\n
    \   \t    \tIS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1',\n    \t    \tIS_SEND_LOCAL_SUBJECT_ID
    CHAR(1) DEFAULT '0',\n    \t    \tIS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0',\n
    \           IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1',\n            IS_USE_USER_DOMAIN_SUBJECT
    CHAR(1) DEFAULT '1',\n            ENABLE_AUTHORIZATION CHAR(1) DEFAULT '0',\n
    \   \t    \tSUBJECT_CLAIM_URI VARCHAR (512),\n    \t    \tIS_SAAS_APP CHAR(1)
    DEFAULT '0',\n    \t    \tIS_DUMB_MODE CHAR(1) DEFAULT '0',\n            PRIMARY
    KEY (ID)\n    )ENGINE INNODB;\n    ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT
    UNIQUE(APP_NAME, TENANT_ID);\n    CREATE TABLE IF NOT EXISTS SP_METADATA (\n                ID
    INTEGER AUTO_INCREMENT,\n                SP_ID INTEGER,\n                NAME
    VARCHAR(255) NOT NULL,\n                VALUE VARCHAR(255) NOT NULL,\n                DISPLAY_NAME
    VARCHAR(255),\n                TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY
    KEY (ID),\n                CONSTRAINT SP_METADATA_CONSTRAINT UNIQUE (SP_ID, NAME),\n
    \               FOREIGN KEY (SP_ID) REFERENCES SP_APP(ID) ON DELETE CASCADE\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH (\n                ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                TENANT_ID INTEGER NOT NULL,\n
    \               INBOUND_AUTH_KEY VARCHAR (255),\n                INBOUND_AUTH_TYPE
    VARCHAR (255) NOT NULL,\n                INBOUND_CONFIG_TYPE VARCHAR (255) NOT
    NULL,\n                PROP_NAME VARCHAR (255),\n                PROP_VALUE VARCHAR
    (1024) ,\n                APP_ID INTEGER NOT NULL,\n                PRIMARY KEY
    (ID)\n    )ENGINE INNODB;\n    ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT
    FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;\n    CREATE TABLE
    IF NOT EXISTS SP_AUTH_STEP (\n                ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \               TENANT_ID INTEGER NOT NULL,\n                STEP_ORDER INTEGER
    DEFAULT 1,\n                APP_ID INTEGER NOT NULL ,\n                IS_SUBJECT_STEP
    CHAR(1) DEFAULT '0',\n                IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0',\n
    \               PRIMARY KEY (ID)\n    )ENGINE INNODB;\n    ALTER TABLE SP_AUTH_STEP
    ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES
    SP_APP (ID) ON DELETE CASCADE;\n    CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP
    (\n                ID INTEGER NOT NULL,\n                TENANT_ID INTEGER NOT
    NULL,\n                AUTHENTICATOR_ID INTEGER NOT NULL,\n                PRIMARY
    KEY (ID, AUTHENTICATOR_ID)\n    )ENGINE INNODB;\n    ALTER TABLE SP_FEDERATED_IDP
    ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID)
    ON DELETE CASCADE;\n    CREATE TABLE IF NOT EXISTS SP_CLAIM_DIALECT (\n    \t
    \  \tID INTEGER NOT NULL AUTO_INCREMENT,\n    \t   \tTENANT_ID INTEGER NOT NULL,\n
    \   \t   \tSP_DIALECT VARCHAR (512) NOT NULL,\n    \t   \tAPP_ID INTEGER NOT NULL,\n
    \   \t   \tPRIMARY KEY (ID));\n    ALTER TABLE SP_CLAIM_DIALECT ADD CONSTRAINT
    DIALECTID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE
    CASCADE;\n    CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING (\n                ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                TENANT_ID INTEGER NOT NULL,\n
    \               IDP_CLAIM VARCHAR (512) NOT NULL ,\n                SP_CLAIM VARCHAR
    (512) NOT NULL ,\n                APP_ID INTEGER NOT NULL,\n                IS_REQUESTED
    VARCHAR(128) DEFAULT '0',\n    \t    IS_MANDATORY VARCHAR(128) DEFAULT '0',\n
    \               DEFAULT_VALUE VARCHAR(255),\n                PRIMARY KEY (ID)\n
    \   )ENGINE INNODB;\n    ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT
    FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;\n    CREATE TABLE
    IF NOT EXISTS SP_ROLE_MAPPING (\n                ID INTEGER NOT NULL AUTO_INCREMENT,\n
    \               TENANT_ID INTEGER NOT NULL,\n                IDP_ROLE VARCHAR
    (255) NOT NULL ,\n                SP_ROLE VARCHAR (255) NOT NULL ,\n                APP_ID
    INTEGER NOT NULL,\n                PRIMARY KEY (ID)\n    )ENGINE INNODB;\n    ALTER
    TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID)
    REFERENCES SP_APP (ID) ON DELETE CASCADE;\n    CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR
    (\n                ID INTEGER NOT NULL AUTO_INCREMENT,\n                TENANT_ID
    INTEGER NOT NULL,\n                AUTHENTICATOR_NAME VARCHAR (255) NOT NULL ,\n
    \               APP_ID INTEGER NOT NULL,\n                PRIMARY KEY (ID)\n    )ENGINE
    INNODB;\n    ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT
    FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;\n    CREATE TABLE
    IF NOT EXISTS SP_PROVISIONING_CONNECTOR (\n                ID INTEGER NOT NULL
    AUTO_INCREMENT,\n                TENANT_ID INTEGER NOT NULL,\n                IDP_NAME
    VARCHAR (255) NOT NULL ,\n                CONNECTOR_NAME VARCHAR (255) NOT NULL
    ,\n                APP_ID INTEGER NOT NULL,\n                IS_JIT_ENABLED CHAR(1)
    NOT NULL DEFAULT '0',\n                BLOCKING CHAR(1) NOT NULL DEFAULT '0',\n
    \               RULE_ENABLED CHAR(1) NOT NULL DEFAULT '0',\n                PRIMARY
    KEY (ID)\n    )ENGINE INNODB;\n    ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT
    PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON
    DELETE CASCADE;\n    CREATE TABLE SP_AUTH_SCRIPT (\n      ID         INTEGER AUTO_INCREMENT
    NOT NULL,\n      TENANT_ID  INTEGER                NOT NULL,\n      APP_ID     INTEGER
    \               NOT NULL,\n      TYPE       VARCHAR(255)           NOT NULL,\n
    \     CONTENT    BLOB    DEFAULT NULL,\n      IS_ENABLED CHAR(1) NOT NULL DEFAULT
    '0',\n      PRIMARY KEY (ID));\n    CREATE TABLE IF NOT EXISTS SP_TEMPLATE (\n
    \     ID         INTEGER AUTO_INCREMENT NOT NULL,\n      TENANT_ID  INTEGER                NOT
    NULL,\n      NAME VARCHAR(255) NOT NULL,\n      DESCRIPTION VARCHAR(1023),\n      CONTENT
    BLOB DEFAULT NULL,\n      PRIMARY KEY (ID),\n      CONSTRAINT SP_TEMPLATE_CONSTRAINT
    UNIQUE (TENANT_ID, NAME));\n    CREATE TABLE IF NOT EXISTS IDN_ARTIFACT_STORE
    (\n      ID          VARCHAR(255)           NOT NULL,\n      TENANT_ID   INTEGER
    \               NOT NULL,\n      ARTIFACT    BLOB                   DEFAULT NULL,\n
    \     IDENTIFIER  VARCHAR(255)           NOT NULL,\n      ARTIFACT_TYPE       VARCHAR(255)
    \  NOT NULL,\n      CONTENT_TYPE        VARCHAR(255)   DEFAULT NULL,\n      PRIMARY
    KEY (ID),\n      UNIQUE (IDENTIFIER , ARTIFACT_TYPE )\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS IDN_AUTH_WAIT_STATUS (\n      ID              INTEGER AUTO_INCREMENT
    NOT NULL,\n      TENANT_ID       INTEGER                NOT NULL,\n      LONG_WAIT_KEY
    \  VARCHAR(255)           NOT NULL,\n      WAIT_STATUS     CHAR(1) NOT NULL DEFAULT
    '1',\n      TIME_CREATED    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n      EXPIRE_TIME
    \    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n      PRIMARY KEY (ID),\n
    \     CONSTRAINT IDN_AUTH_WAIT_STATUS_KEY UNIQUE (LONG_WAIT_KEY));\n    CREATE
    TABLE IF NOT EXISTS IDP (\n    \t\t\tID INTEGER AUTO_INCREMENT,\n    \t\t\tTENANT_ID
    INTEGER,\n    \t\t\tNAME VARCHAR(254) NOT NULL,\n    \t\t\tIS_ENABLED CHAR(1)
    NOT NULL DEFAULT '1',\n    \t\t\tIS_PRIMARY CHAR(1) NOT NULL DEFAULT '0',\n    \t\t\tHOME_REALM_ID
    VARCHAR(254),\n    \t\t\tIMAGE MEDIUMBLOB,\n    \t\t\tCERTIFICATE BLOB,\n    \t\t\tALIAS
    VARCHAR(254),\n    \t\t\tINBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0',\n
    \   \t\t\tINBOUND_PROV_USER_STORE_ID VARCHAR(254),\n     \t\t\tUSER_CLAIM_URI
    VARCHAR(254),\n     \t\t\tROLE_CLAIM_URI VARCHAR(254),\n      \t\t\tDESCRIPTION
    VARCHAR (1024),\n     \t\t\tDEFAULT_AUTHENTICATOR_NAME VARCHAR(254),\n     \t\t\tDEFAULT_PRO_CONNECTOR_NAME
    VARCHAR(254),\n     \t\t\tPROVISIONING_ROLE VARCHAR(128),\n     \t\t\tIS_FEDERATION_HUB
    CHAR(1) NOT NULL DEFAULT '0',\n     \t\t\tIS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL
    DEFAULT '0',\n                DISPLAY_NAME VARCHAR(255),\n    \t\t\tPRIMARY KEY
    (ID),\n    \t\t\tUNIQUE (TENANT_ID, NAME)\n    )ENGINE INNODB;\n    CREATE TABLE
    IF NOT EXISTS IDP_ROLE (\n    \t\t\tID INTEGER AUTO_INCREMENT,\n    \t\t\tIDP_ID
    INTEGER,\n    \t\t\tTENANT_ID INTEGER,\n    \t\t\tROLE VARCHAR(254),\n    \t\t\tPRIMARY
    KEY (ID),\n    \t\t\tUNIQUE (IDP_ID, ROLE),\n    \t\t\tFOREIGN KEY (IDP_ID) REFERENCES
    IDP(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    IDP_ROLE_MAPPING (\n    \t\t\tID INTEGER AUTO_INCREMENT,\n    \t\t\tIDP_ROLE_ID
    INTEGER,\n    \t\t\tTENANT_ID INTEGER,\n    \t\t\tUSER_STORE_ID VARCHAR (253),\n
    \   \t\t\tLOCAL_ROLE VARCHAR(253),\n    \t\t\tPRIMARY KEY (ID),\n    \t\t\tUNIQUE
    (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE),\n    \t\t\tFOREIGN KEY (IDP_ROLE_ID)
    REFERENCES IDP_ROLE(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE
    IF NOT EXISTS IDP_CLAIM (\n    \t\t\tID INTEGER AUTO_INCREMENT,\n    \t\t\tIDP_ID
    INTEGER,\n    \t\t\tTENANT_ID INTEGER,\n    \t\t\tCLAIM VARCHAR(254),\n    \t\t\tPRIMARY
    KEY (ID),\n    \t\t\tUNIQUE (IDP_ID, CLAIM),\n    \t\t\tFOREIGN KEY (IDP_ID) REFERENCES
    IDP(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    IDP_CLAIM_MAPPING (\n                ID INTEGER AUTO_INCREMENT,\n                IDP_CLAIM_ID
    INTEGER,\n                TENANT_ID INTEGER,\n                LOCAL_CLAIM VARCHAR(253),\n
    \               DEFAULT_VALUE VARCHAR(255),\n                IS_REQUESTED VARCHAR(128)
    DEFAULT '0',\n                PRIMARY KEY (ID),\n                UNIQUE (IDP_CLAIM_ID,
    TENANT_ID, LOCAL_CLAIM),\n                FOREIGN KEY (IDP_CLAIM_ID) REFERENCES
    IDP_CLAIM(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS IDP_AUTHENTICATOR (\n                ID INTEGER AUTO_INCREMENT,\n                TENANT_ID
    INTEGER,\n                IDP_ID INTEGER,\n                NAME VARCHAR(255) NOT
    NULL,\n                IS_ENABLED CHAR (1) DEFAULT '1',\n                DISPLAY_NAME
    VARCHAR(255),\n                PRIMARY KEY (ID),\n                UNIQUE (TENANT_ID,
    IDP_ID, NAME),\n                FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE
    CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDP_METADATA (\n
    \               ID INTEGER AUTO_INCREMENT,\n                IDP_ID INTEGER,\n
    \               NAME VARCHAR(255) NOT NULL,\n                VALUE VARCHAR(255)
    NOT NULL,\n                DISPLAY_NAME VARCHAR(255),\n                TENANT_ID
    INTEGER DEFAULT -1,\n                PRIMARY KEY (ID),\n                CONSTRAINT
    IDP_METADATA_CONSTRAINT UNIQUE (IDP_ID, NAME),\n                FOREIGN KEY (IDP_ID)
    REFERENCES IDP(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF
    NOT EXISTS IDP_AUTHENTICATOR_PROPERTY (\n                ID INTEGER AUTO_INCREMENT,\n
    \               TENANT_ID INTEGER,\n                AUTHENTICATOR_ID INTEGER,\n
    \               PROPERTY_KEY VARCHAR(255) NOT NULL,\n                PROPERTY_VALUE
    VARCHAR(2047),\n                IS_SECRET CHAR (1) DEFAULT '0',\n                PRIMARY
    KEY (ID),\n                UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY),\n
    \               FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID)
    ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG
    (\n                ID INTEGER AUTO_INCREMENT,\n                TENANT_ID INTEGER,\n
    \               IDP_ID INTEGER,\n                PROVISIONING_CONNECTOR_TYPE VARCHAR(255)
    NOT NULL,\n                IS_ENABLED CHAR (1) DEFAULT '0',\n                IS_BLOCKING
    CHAR (1) DEFAULT '0',\n                IS_RULES_ENABLED CHAR (1) DEFAULT '0',\n
    \               PRIMARY KEY (ID),\n                UNIQUE (TENANT_ID, IDP_ID,
    PROVISIONING_CONNECTOR_TYPE),\n                FOREIGN KEY (IDP_ID) REFERENCES
    IDP(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    IDP_PROV_CONFIG_PROPERTY (\n                ID INTEGER AUTO_INCREMENT,\n                TENANT_ID
    INTEGER,\n                PROVISIONING_CONFIG_ID INTEGER,\n                PROPERTY_KEY
    VARCHAR(255) NOT NULL,\n                PROPERTY_VALUE VARCHAR(2048),\n                PROPERTY_BLOB_VALUE
    BLOB,\n                PROPERTY_TYPE CHAR(32) NOT NULL,\n                IS_SECRET
    CHAR (1) DEFAULT '0',\n                PRIMARY KEY (ID),\n                UNIQUE
    (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY),\n                FOREIGN KEY
    (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY (\n
    \               ID INTEGER AUTO_INCREMENT,\n                PROVISIONING_CONFIG_ID
    INTEGER,\n                ENTITY_TYPE VARCHAR(255) NOT NULL,\n                ENTITY_LOCAL_USERSTORE
    VARCHAR(255) NOT NULL,\n                ENTITY_NAME VARCHAR(255) NOT NULL,\n                ENTITY_VALUE
    VARCHAR(255),\n                TENANT_ID INTEGER,\n                ENTITY_LOCAL_ID
    VARCHAR(255),\n                PRIMARY KEY (ID),\n                UNIQUE (ENTITY_TYPE,
    TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID),\n                UNIQUE
    (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE),\n                FOREIGN
    KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE
    CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM (\n
    \               ID INTEGER AUTO_INCREMENT,\n                TENANT_ID INTEGER,\n
    \               IDP_ID INTEGER,\n                CLAIM_URI VARCHAR(255) NOT NULL,\n
    \               DEFAULT_VALUE VARCHAR(255),\n                IS_REQUESTED VARCHAR(128)
    DEFAULT '0',\n                PRIMARY KEY (ID),\n                UNIQUE (TENANT_ID,
    IDP_ID, CLAIM_URI),\n                FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON
    DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID
    (\n                ID INTEGER AUTO_INCREMENT,\n                IDP_USER_ID VARCHAR(255)
    NOT NULL,\n                TENANT_ID INTEGER DEFAULT -1234,\n                IDP_ID
    INTEGER NOT NULL,\n                DOMAIN_NAME VARCHAR(255) NOT NULL,\n                USER_NAME
    VARCHAR(255) NOT NULL,\n                PRIMARY KEY (ID),\n                UNIQUE(IDP_USER_ID,
    TENANT_ID, IDP_ID),\n                FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON
    DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION
    (\n                ASSOCIATION_KEY VARCHAR(255) NOT NULL,\n                TENANT_ID
    INTEGER,\n                DOMAIN_NAME VARCHAR(255) NOT NULL,\n                USER_NAME
    VARCHAR(255) NOT NULL,\n                PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE (\n                TENANT_ID
    INTEGER,\n                DOMAIN_NAME VARCHAR(255) NOT NULL,\n                USER_NAME
    VARCHAR(45) NOT NULL,\n                TIME_REGISTERED TIMESTAMP,\n                KEY_HANDLE
    VARCHAR(200) NOT NULL,\n                DEVICE_DATA VARCHAR(2048) NOT NULL,\n
    \               PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)\n
    \           )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS FIDO2_DEVICE_STORE
    (\n                TENANT_ID INTEGER,\n                DOMAIN_NAME VARCHAR(255)
    NOT NULL,\n                USER_NAME VARCHAR(45) NOT NULL,\n                TIME_REGISTERED
    TIMESTAMP,\n                USER_HANDLE VARCHAR(64) NOT NULL,\n                CREDENTIAL_ID
    VARCHAR(200) NOT NULL,\n                PUBLIC_KEY_COSE VARCHAR(1024) NOT NULL,\n
    \               SIGNATURE_COUNT BIGINT,\n                USER_IDENTITY VARCHAR(512)
    NOT NULL,\n                PRIMARY KEY (CREDENTIAL_ID, USER_HANDLE)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS WF_REQUEST (\n        UUID VARCHAR (45),\n
    \       CREATED_BY VARCHAR (255),\n        TENANT_ID INTEGER DEFAULT -1,\n        OPERATION_TYPE
    VARCHAR (50),\n        CREATED_AT TIMESTAMP,\n        UPDATED_AT TIMESTAMP DEFAULT
    CURRENT_TIMESTAMP,\n        STATUS VARCHAR (30),\n        REQUEST BLOB,\n        PRIMARY
    KEY (UUID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE
    (\n        PROFILE_NAME VARCHAR(45),\n        HOST_URL_MANAGER VARCHAR(255),\n
    \       HOST_URL_WORKER VARCHAR(255),\n        USERNAME VARCHAR(45),\n        PASSWORD
    VARCHAR(1023),\n        CALLBACK_HOST VARCHAR (45),\n        CALLBACK_USERNAME
    VARCHAR (45),\n        CALLBACK_PASSWORD VARCHAR (255),\n        TENANT_ID INTEGER
    DEFAULT -1,\n        PRIMARY KEY (PROFILE_NAME, TENANT_ID)\n    )ENGINE INNODB;\n
    \   CREATE TABLE IF NOT EXISTS WF_WORKFLOW(\n        ID VARCHAR (45),\n        WF_NAME
    VARCHAR (45),\n        DESCRIPTION VARCHAR (255),\n        TEMPLATE_ID VARCHAR
    (45),\n        IMPL_ID VARCHAR (45),\n        TENANT_ID INTEGER DEFAULT -1,\n
    \       PRIMARY KEY (ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    WF_WORKFLOW_ASSOCIATION(\n        ID INTEGER NOT NULL AUTO_INCREMENT,\n        ASSOC_NAME
    VARCHAR (45),\n        EVENT_ID VARCHAR(45),\n        ASSOC_CONDITION VARCHAR
    (2000),\n        WORKFLOW_ID VARCHAR (45),\n        IS_ENABLED CHAR (1) DEFAULT
    '1',\n        TENANT_ID INTEGER DEFAULT -1,\n        PRIMARY KEY(ID),\n        FOREIGN
    KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE\n    )ENGINE INNODB;\n
    \   CREATE TABLE IF NOT EXISTS WF_WORKFLOW_CONFIG_PARAM(\n        WORKFLOW_ID
    VARCHAR (45),\n        PARAM_NAME VARCHAR (45),\n        PARAM_VALUE VARCHAR (1000),\n
    \       PARAM_QNAME VARCHAR (45),\n        PARAM_HOLDER VARCHAR (45),\n        TENANT_ID
    INTEGER DEFAULT -1,\n        PRIMARY KEY (WORKFLOW_ID, PARAM_NAME, PARAM_QNAME,
    PARAM_HOLDER),\n        FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON
    DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS WF_REQUEST_ENTITY_RELATIONSHIP(\n
    \     REQUEST_ID VARCHAR (45),\n      ENTITY_NAME VARCHAR (255),\n      ENTITY_TYPE
    VARCHAR (50),\n      TENANT_ID INTEGER DEFAULT -1,\n      PRIMARY KEY(REQUEST_ID,
    ENTITY_NAME, ENTITY_TYPE, TENANT_ID),\n      FOREIGN KEY (REQUEST_ID) REFERENCES
    WF_REQUEST(UUID)ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS WF_WORKFLOW_REQUEST_RELATION(\n      RELATIONSHIP_ID VARCHAR (45),\n      WORKFLOW_ID
    VARCHAR (45),\n      REQUEST_ID VARCHAR (45),\n      UPDATED_AT TIMESTAMP,\n      STATUS
    VARCHAR (30),\n      TENANT_ID INTEGER DEFAULT -1,\n      PRIMARY KEY (RELATIONSHIP_ID),\n
    \     FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE,\n
    \     FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_RECOVERY_DATA (\n      USER_NAME
    VARCHAR(255) NOT NULL,\n      USER_DOMAIN VARCHAR(127) NOT NULL,\n      TENANT_ID
    INTEGER DEFAULT -1,\n      CODE VARCHAR(255) NOT NULL,\n      SCENARIO VARCHAR(255)
    NOT NULL,\n      STEP VARCHAR(127) NOT NULL,\n      TIME_CREATED TIMESTAMP NOT
    NULL DEFAULT CURRENT_TIMESTAMP,\n      REMAINING_SETS VARCHAR(2500) DEFAULT NULL,\n
    \     PRIMARY KEY(USER_NAME, USER_DOMAIN, TENANT_ID, SCENARIO,STEP),\n      UNIQUE(CODE)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_PASSWORD_HISTORY_DATA
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      USER_NAME   VARCHAR(255) NOT
    NULL,\n      USER_DOMAIN VARCHAR(127) NOT NULL,\n      TENANT_ID   INTEGER DEFAULT
    -1,\n      SALT_VALUE  VARCHAR(255),\n      HASH        VARCHAR(255) NOT NULL,\n
    \     TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n      PRIMARY
    KEY(ID),\n      UNIQUE (USER_NAME,USER_DOMAIN,TENANT_ID,SALT_VALUE,HASH)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_CLAIM_DIALECT (\n      ID INTEGER
    NOT NULL AUTO_INCREMENT,\n      DIALECT_URI VARCHAR (255) NOT NULL,\n      TENANT_ID
    INTEGER NOT NULL,\n      PRIMARY KEY (ID),\n      CONSTRAINT DIALECT_URI_CONSTRAINT
    UNIQUE (DIALECT_URI, TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS IDN_CLAIM (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      DIALECT_ID
    INTEGER,\n      CLAIM_URI VARCHAR (255) NOT NULL,\n      TENANT_ID INTEGER NOT
    NULL,\n      PRIMARY KEY (ID),\n      FOREIGN KEY (DIALECT_ID) REFERENCES IDN_CLAIM_DIALECT(ID)
    ON DELETE CASCADE,\n      CONSTRAINT CLAIM_URI_CONSTRAINT UNIQUE (DIALECT_ID,
    CLAIM_URI, TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPED_ATTRIBUTE
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      LOCAL_CLAIM_ID INTEGER,\n
    \     USER_STORE_DOMAIN_NAME VARCHAR (255) NOT NULL,\n      ATTRIBUTE_NAME VARCHAR
    (255) NOT NULL,\n      TENANT_ID INTEGER NOT NULL,\n      PRIMARY KEY (ID),\n
    \     FOREIGN KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,\n
    \     CONSTRAINT USER_STORE_DOMAIN_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, USER_STORE_DOMAIN_NAME,
    TENANT_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_CLAIM_PROPERTY
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      LOCAL_CLAIM_ID INTEGER,\n
    \     PROPERTY_NAME VARCHAR (255) NOT NULL,\n      PROPERTY_VALUE VARCHAR (255)
    NOT NULL,\n      TENANT_ID INTEGER NOT NULL,\n      PRIMARY KEY (ID),\n      FOREIGN
    KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,\n      CONSTRAINT
    PROPERTY_NAME_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, PROPERTY_NAME, TENANT_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPING (\n      ID INTEGER
    NOT NULL AUTO_INCREMENT,\n      EXT_CLAIM_ID INTEGER NOT NULL,\n      MAPPED_LOCAL_CLAIM_ID
    INTEGER NOT NULL,\n      TENANT_ID INTEGER NOT NULL,\n      PRIMARY KEY (ID),\n
    \     FOREIGN KEY (EXT_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,\n
    \     FOREIGN KEY (MAPPED_LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,\n
    \     CONSTRAINT EXT_TO_LOC_MAPPING_CONSTRN UNIQUE (EXT_CLAIM_ID, TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS  IDN_SAML2_ASSERTION_STORE
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      SAML2_ID  VARCHAR(255) ,\n
    \     SAML2_ISSUER  VARCHAR(255) ,\n      SAML2_SUBJECT  VARCHAR(255) ,\n      SAML2_SESSION_INDEX
    \ VARCHAR(255) ,\n      SAML2_AUTHN_CONTEXT_CLASS_REF  VARCHAR(255) ,\n      SAML2_ASSERTION
    \ VARCHAR(4096) ,\n      ASSERTION BLOB ,\n      PRIMARY KEY (ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IDN_SAML2_ARTIFACT_STORE (\n      ID INT(11) NOT NULL
    AUTO_INCREMENT,\n      SOURCE_ID VARCHAR(255) NOT NULL,\n      MESSAGE_HANDLER
    VARCHAR(255) NOT NULL,\n      AUTHN_REQ_DTO BLOB NOT NULL,\n      SESSION_ID VARCHAR(255)
    NOT NULL,\n      EXP_TIMESTAMP TIMESTAMP NOT NULL,\n      INIT_TIMESTAMP TIMESTAMP
    NOT NULL DEFAULT CURRENT_TIMESTAMP,\n      ASSERTION_ID VARCHAR(255),\n      PRIMARY
    KEY (`ID`)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_JTI (\n
    \     JWT_ID VARCHAR(255) NOT NULL,\n      EXP_TIME TIMESTAMP NOT NULL ,\n      TIME_CREATED
    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\n      PRIMARY KEY (JWT_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS  IDN_OIDC_PROPERTY (\n      ID INTEGER
    NOT NULL AUTO_INCREMENT,\n      TENANT_ID  INTEGER,\n      CONSUMER_KEY  VARCHAR(255)
    ,\n      PROPERTY_KEY  VARCHAR(255) NOT NULL,\n      PROPERTY_VALUE  VARCHAR(2047)
    ,\n      PRIMARY KEY (ID),\n      FOREIGN KEY (CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY)
    ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_REFERENCE
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      CONSUMER_KEY_ID INTEGER ,\n
    \     CODE_ID VARCHAR(255) ,\n      TOKEN_ID VARCHAR(255) ,\n      SESSION_DATA_KEY
    VARCHAR(255),\n      PRIMARY KEY (ID),\n      FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES
    IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE,\n      FOREIGN KEY (TOKEN_ID) REFERENCES
    IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE,\n      FOREIGN KEY (CODE_ID)
    REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE(CODE_ID) ON DELETE CASCADE\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_CLAIMS (\n      ID
    INTEGER NOT NULL AUTO_INCREMENT,\n      REQ_OBJECT_ID INTEGER,\n      CLAIM_ATTRIBUTE
    VARCHAR(255) ,\n      ESSENTIAL CHAR(1) NOT NULL DEFAULT '0' ,\n      VALUE VARCHAR(255)
    ,\n      IS_USERINFO CHAR(1) NOT NULL DEFAULT '0',\n      PRIMARY KEY (ID),\n
    \     FOREIGN KEY (REQ_OBJECT_ID) REFERENCES IDN_OIDC_REQ_OBJECT_REFERENCE (ID)
    ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJ_CLAIM_VALUES
    (\n      ID INTEGER NOT NULL AUTO_INCREMENT,\n      REQ_OBJECT_CLAIMS_ID INTEGER
    ,\n      CLAIM_VALUES VARCHAR(255) ,\n      PRIMARY KEY (ID),\n      FOREIGN KEY
    (REQ_OBJECT_CLAIMS_ID) REFERENCES  IDN_OIDC_REQ_OBJECT_CLAIMS(ID) ON DELETE CASCADE\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_CERTIFICATE (\n                 ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                 NAME VARCHAR(100),\n                 CERTIFICATE_IN_PEM
    BLOB,\n                 TENANT_ID INTEGER DEFAULT 0,\n                 PRIMARY
    KEY(ID),\n                 CONSTRAINT CERTIFICATE_UNIQUE_KEY UNIQUE (NAME, TENANT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_SCOPE (\n                ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                NAME VARCHAR(255) NOT NULL,\n
    \               TENANT_ID INTEGER DEFAULT -1,\n                PRIMARY KEY (ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS IDN_OIDC_SCOPE_CLAIM_MAPPING
    (\n                ID INTEGER NOT NULL AUTO_INCREMENT,\n                SCOPE_ID
    INTEGER,\n                EXTERNAL_CLAIM_ID INTEGER,\n                PRIMARY
    KEY (ID),\n                FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OIDC_SCOPE(ID)
    ON DELETE CASCADE,\n                FOREIGN KEY (EXTERNAL_CLAIM_ID) REFERENCES
    IDN_CLAIM(ID) ON DELETE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS IDN_FUNCTION_LIBRARY (\n    \tNAME VARCHAR(255) NOT NULL,\n    \tDESCRIPTION
    VARCHAR(1023),\n    \tTYPE VARCHAR(255) NOT NULL,\n    \tTENANT_ID INTEGER NOT
    NULL,\n    \tDATA BLOB NOT NULL,\n    \tPRIMARY KEY (TENANT_ID,NAME)\n    )ENGINE
    INNODB;\n    -- --------------------------- INDEX CREATION -----------------------------\n
    \   -- IDN_OAUTH2_ACCESS_TOKEN --\n    CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED);\n
    \   CREATE INDEX IDX_ATH ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN_HASH);\n    CREATE
    INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE,
    USER_TYPE);\n    CREATE INDEX IDX_AT_TI_UD ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER,
    TENANT_ID, TOKEN_STATE, USER_DOMAIN);\n    CREATE INDEX IDX_AT_AU_TID_UD_TS_CKID
    ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, TENANT_ID, USER_DOMAIN, TOKEN_STATE, CONSUMER_KEY_ID);\n
    \   CREATE INDEX IDX_AT_AT ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN);\n    CREATE
    INDEX IDX_AT_AU_CKID_TS_UT ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, CONSUMER_KEY_ID,
    TOKEN_STATE, USER_TYPE);\n    CREATE INDEX IDX_AT_RTH ON IDN_OAUTH2_ACCESS_TOKEN(REFRESH_TOKEN_HASH);\n
    \   CREATE INDEX IDX_AT_RT ON IDN_OAUTH2_ACCESS_TOKEN(REFRESH_TOKEN);\n    --
    IDN_OAUTH2_AUTHORIZATION_CODE --\n    CREATE INDEX IDX_AUTHORIZATION_CODE_HASH
    ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHORIZATION_CODE_HASH, CONSUMER_KEY_ID);\n
    \   CREATE INDEX IDX_AUTHORIZATION_CODE_AU_TI ON IDN_OAUTH2_AUTHORIZATION_CODE
    (AUTHZ_USER, TENANT_ID, USER_DOMAIN, STATE);\n    CREATE INDEX IDX_AC_CKID ON
    IDN_OAUTH2_AUTHORIZATION_CODE(CONSUMER_KEY_ID);\n    CREATE INDEX IDX_AC_TID ON
    IDN_OAUTH2_AUTHORIZATION_CODE(TOKEN_ID);\n    CREATE INDEX IDX_AC_AC_CKID ON IDN_OAUTH2_AUTHORIZATION_CODE(AUTHORIZATION_CODE,
    CONSUMER_KEY_ID);\n    -- IDN_SCIM_GROUP --\n    CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN
    ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME);\n    CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN_AN
    ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME, ATTR_NAME(500));\n    -- IDN_AUTH_SESSION_STORE
    --\n    CREATE INDEX IDX_IDN_AUTH_SESSION_TIME ON IDN_AUTH_SESSION_STORE (TIME_CREATED);\n
    \   -- IDN_AUTH_TEMP_SESSION_STORE --\n    CREATE INDEX IDX_IDN_AUTH_TMP_SESSION_TIME
    ON IDN_AUTH_TEMP_SESSION_STORE (TIME_CREATED);\n    -- IDN_OIDC_SCOPE_CLAIM_MAPPING
    --\n    CREATE INDEX IDX_AT_SI_ECI ON IDN_OIDC_SCOPE_CLAIM_MAPPING(SCOPE_ID, EXTERNAL_CLAIM_ID);\n
    \   -- IDN_OAUTH2_SCOPE --\n    CREATE INDEX IDX_SC_TID ON IDN_OAUTH2_SCOPE(TENANT_ID);\n
    \   CREATE INDEX IDX_SC_N_TID ON IDN_OAUTH2_SCOPE(NAME, TENANT_ID);\n    -- IDN_OAUTH2_SCOPE_BINDING
    --\n    CREATE INDEX IDX_SB_SCPID ON IDN_OAUTH2_SCOPE_BINDING(SCOPE_ID);\n    --
    IDN_OIDC_REQ_OBJECT_REFERENCE --\n    CREATE INDEX IDX_OROR_TID ON IDN_OIDC_REQ_OBJECT_REFERENCE(TOKEN_ID);\n
    \   -- IDN_OAUTH2_ACCESS_TOKEN_SCOPE --\n    CREATE INDEX IDX_ATS_TID ON IDN_OAUTH2_ACCESS_TOKEN_SCOPE(TOKEN_ID);\n
    \   -- SP_TEMPLATE --\n    CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID,
    NAME);\n    -- IDN_AUTH_USER --\n    CREATE INDEX IDX_AUTH_USER_UN_TID_DN ON IDN_AUTH_USER
    (USER_NAME, TENANT_ID, DOMAIN_NAME);\n    CREATE INDEX IDX_AUTH_USER_DN_TOD ON
    IDN_AUTH_USER (DOMAIN_NAME, TENANT_ID);\n    -- IDN_AUTH_USER_SESSION_MAPPING
    --\n    CREATE INDEX IDX_USER_ID ON IDN_AUTH_USER_SESSION_MAPPING (USER_ID);\n
    \   CREATE INDEX IDX_SESSION_ID ON IDN_AUTH_USER_SESSION_MAPPING (SESSION_ID);\n
    \   -- IDN_OAUTH_CONSUMER_APPS --\n    CREATE INDEX IDX_OCA_UM_TID_UD_APN ON IDN_OAUTH_CONSUMER_APPS(USERNAME,TENANT_ID,USER_DOMAIN,
    APP_NAME);\n    -- IDX_SPI_APP --\n    CREATE INDEX IDX_SPI_APP ON SP_INBOUND_AUTH(APP_ID);\n
    \   -- IDN_OIDC_PROPERTY --\n    CREATE INDEX IDX_IOP_TID_CK ON IDN_OIDC_PROPERTY(TENANT_ID,CONSUMER_KEY);\n
    \   -- IDN_FIDO2_PROPERTY --\n    CREATE INDEX IDX_FIDO2_STR ON FIDO2_DEVICE_STORE(USER_NAME,
    TENANT_ID, DOMAIN_NAME, CREDENTIAL_ID, USER_HANDLE);\n    -- End of IDENTITY Tables--\n
    \   -- Start of CONSENT-MGT Tables --\n    CREATE TABLE CM_PII_CATEGORY (\n      ID
    \          INTEGER AUTO_INCREMENT,\n      NAME         VARCHAR(255) NOT NULL,\n
    \     DESCRIPTION  VARCHAR(1023),\n      DISPLAY_NAME VARCHAR(255),\n      IS_SENSITIVE
    INTEGER      NOT NULL,\n      TENANT_ID    INTEGER DEFAULT '-1234',\n      UNIQUE
    KEY (NAME, TENANT_ID),\n      PRIMARY KEY (ID)\n    );\n    CREATE TABLE CM_RECEIPT
    (\n      CONSENT_RECEIPT_ID  VARCHAR(255) NOT NULL,\n      VERSION             VARCHAR(255)
    NOT NULL,\n      JURISDICTION        VARCHAR(255) NOT NULL,\n      CONSENT_TIMESTAMP
    \  TIMESTAMP    NOT NULL,\n      COLLECTION_METHOD   VARCHAR(255) NOT NULL,\n
    \     LANGUAGE            VARCHAR(255) NOT NULL,\n      PII_PRINCIPAL_ID    VARCHAR(255)
    NOT NULL,\n      PRINCIPAL_TENANT_ID INTEGER DEFAULT '-1234',\n      POLICY_URL
    \         VARCHAR(255) NOT NULL,\n      STATE               VARCHAR(255) NOT NULL,\n
    \     PII_CONTROLLER      VARCHAR(2048) NOT NULL,\n      PRIMARY KEY (CONSENT_RECEIPT_ID)\n
    \   );\n    CREATE TABLE CM_PURPOSE (\n      ID            INTEGER AUTO_INCREMENT,\n
    \     NAME          VARCHAR(255) NOT NULL,\n      DESCRIPTION   VARCHAR(1023),\n
    \     PURPOSE_GROUP VARCHAR(255) NOT NULL,\n      GROUP_TYPE    VARCHAR(255) NOT
    NULL,\n      TENANT_ID     INTEGER DEFAULT '-1234',\n      UNIQUE KEY (NAME, TENANT_ID,
    PURPOSE_GROUP, GROUP_TYPE),\n      PRIMARY KEY (ID)\n    );\n    CREATE TABLE
    CM_PURPOSE_CATEGORY (\n      ID          INTEGER AUTO_INCREMENT,\n      NAME        VARCHAR(255)
    NOT NULL,\n      DESCRIPTION VARCHAR(1023),\n      TENANT_ID   INTEGER DEFAULT
    '-1234',\n      UNIQUE KEY (NAME, TENANT_ID),\n      PRIMARY KEY (ID)\n    );\n
    \   CREATE TABLE CM_RECEIPT_SP_ASSOC (\n      ID                 INTEGER AUTO_INCREMENT,\n
    \     CONSENT_RECEIPT_ID VARCHAR(255) NOT NULL,\n      SP_NAME            VARCHAR(255)
    NOT NULL,\n      SP_DISPLAY_NAME    VARCHAR(255),\n      SP_DESCRIPTION     VARCHAR(255),\n
    \     SP_TENANT_ID       INTEGER DEFAULT '-1234',\n      UNIQUE KEY (CONSENT_RECEIPT_ID,
    SP_NAME, SP_TENANT_ID),\n      PRIMARY KEY (ID)\n    );\n    CREATE TABLE CM_SP_PURPOSE_ASSOC
    (\n      ID                     INTEGER AUTO_INCREMENT,\n      RECEIPT_SP_ASSOC
    \      INTEGER      NOT NULL,\n      PURPOSE_ID             INTEGER      NOT NULL,\n
    \     CONSENT_TYPE           VARCHAR(255) NOT NULL,\n      IS_PRIMARY_PURPOSE
    \    INTEGER      NOT NULL,\n      TERMINATION            VARCHAR(255) NOT NULL,\n
    \     THIRD_PARTY_DISCLOSURE INTEGER      NOT NULL,\n      THIRD_PARTY_NAME       VARCHAR(255),\n
    \     UNIQUE KEY (RECEIPT_SP_ASSOC, PURPOSE_ID),\n      PRIMARY KEY (ID)\n    );\n
    \   CREATE TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC (\n      SP_PURPOSE_ASSOC_ID INTEGER
    NOT NULL,\n      PURPOSE_CATEGORY_ID INTEGER NOT NULL,\n      UNIQUE KEY (SP_PURPOSE_ASSOC_ID,
    PURPOSE_CATEGORY_ID)\n    );\n    CREATE TABLE CM_PURPOSE_PII_CAT_ASSOC (\n      PURPOSE_ID
    \        INTEGER NOT NULL,\n      CM_PII_CATEGORY_ID INTEGER NOT NULL,\n      IS_MANDATORY
    \      INTEGER NOT NULL,\n      UNIQUE KEY (PURPOSE_ID, CM_PII_CATEGORY_ID)\n
    \   );\n    CREATE TABLE CM_SP_PURPOSE_PII_CAT_ASSOC (\n      SP_PURPOSE_ASSOC_ID
    INTEGER NOT NULL,\n      PII_CATEGORY_ID     INTEGER NOT NULL,\n      VALIDITY
    \           VARCHAR(1023),\n      UNIQUE KEY (SP_PURPOSE_ASSOC_ID, PII_CATEGORY_ID)\n
    \   );\n    CREATE TABLE CM_CONSENT_RECEIPT_PROPERTY (\n      CONSENT_RECEIPT_ID
    VARCHAR(255)  NOT NULL,\n      NAME               VARCHAR(255)  NOT NULL,\n      VALUE
    \             VARCHAR(1023) NOT NULL,\n      UNIQUE KEY (CONSENT_RECEIPT_ID, NAME)\n
    \   );\n    ALTER TABLE CM_RECEIPT_SP_ASSOC\n      ADD CONSTRAINT CM_RECEIPT_SP_ASSOC_fk0
    FOREIGN KEY (CONSENT_RECEIPT_ID) REFERENCES CM_RECEIPT (CONSENT_RECEIPT_ID);\n
    \   ALTER TABLE CM_SP_PURPOSE_ASSOC\n      ADD CONSTRAINT CM_SP_PURPOSE_ASSOC_fk0
    FOREIGN KEY (RECEIPT_SP_ASSOC) REFERENCES CM_RECEIPT_SP_ASSOC (ID);\n    ALTER
    TABLE CM_SP_PURPOSE_ASSOC\n      ADD CONSTRAINT CM_SP_PURPOSE_ASSOC_fk1 FOREIGN
    KEY (PURPOSE_ID) REFERENCES CM_PURPOSE (ID);\n    ALTER TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC\n
    \     ADD CONSTRAINT CM_SP_P_P_CAT_ASSOC_fk0 FOREIGN KEY (SP_PURPOSE_ASSOC_ID)
    REFERENCES CM_SP_PURPOSE_ASSOC (ID);\n    ALTER TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC\n
    \     ADD CONSTRAINT CM_SP_P_P_CAT_ASSOC_fk1 FOREIGN KEY (PURPOSE_CATEGORY_ID)
    REFERENCES CM_PURPOSE_CATEGORY (ID);\n    ALTER TABLE CM_SP_PURPOSE_PII_CAT_ASSOC\n
    \     ADD CONSTRAINT CM_SP_P_PII_CAT_ASSOC_fk0 FOREIGN KEY (SP_PURPOSE_ASSOC_ID)
    REFERENCES CM_SP_PURPOSE_ASSOC (ID);\n    ALTER TABLE CM_SP_PURPOSE_PII_CAT_ASSOC\n
    \     ADD CONSTRAINT CM_SP_P_PII_CAT_ASSOC_fk1 FOREIGN KEY (PII_CATEGORY_ID) REFERENCES
    CM_PII_CATEGORY (ID);\n    ALTER TABLE CM_CONSENT_RECEIPT_PROPERTY\n      ADD
    CONSTRAINT CM_CONSENT_RECEIPT_PRT_fk0 FOREIGN KEY (CONSENT_RECEIPT_ID) REFERENCES
    CM_RECEIPT (CONSENT_RECEIPT_ID);\n    INSERT INTO CM_PURPOSE (NAME, DESCRIPTION,
    PURPOSE_GROUP, GROUP_TYPE, TENANT_ID) VALUES ('DEFAULT', 'For core functionalities
    of the product', 'DEFAULT', 'SP', '-1234');\n    INSERT INTO CM_PURPOSE_CATEGORY
    (NAME, DESCRIPTION, TENANT_ID) VALUES ('DEFAULT','For core functionalities of
    the product', '-1234');\n    -- End of CONSENT-MGT Tables --\n    -- Start of
    API-MGT Tables --\n    CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER (\n        SUBSCRIBER_ID
    INTEGER AUTO_INCREMENT,\n        USER_ID VARCHAR(255) NOT NULL,\n        TENANT_ID
    INTEGER NOT NULL,\n        EMAIL_ADDRESS VARCHAR(256) NULL,\n        DATE_SUBSCRIBED
    TIMESTAMP NOT NULL,\n        PRIMARY KEY (SUBSCRIBER_ID),\n        CREATED_BY
    VARCHAR(100),\n        CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        UPDATED_BY
    VARCHAR(100),\n        UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        UNIQUE
    (TENANT_ID,USER_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS AM_APPLICATION
    (\n        APPLICATION_ID INTEGER AUTO_INCREMENT,\n        NAME VARCHAR(100),\n
    \       SUBSCRIBER_ID INTEGER,\n        APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited',\n
    \       CALLBACK_URL VARCHAR(512),\n        DESCRIPTION VARCHAR(512),\n        APPLICATION_STATUS
    VARCHAR(50) DEFAULT 'APPROVED',\n        GROUP_ID VARCHAR(100),\n        CREATED_BY
    VARCHAR(100),\n        CREATED_TIME TIMESTAMP,\n        UPDATED_BY VARCHAR(100),\n
    \       UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        UUID VARCHAR(256),\n
    \       TOKEN_TYPE VARCHAR(10),\n        FOREIGN KEY(SUBSCRIBER_ID) REFERENCES
    AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY
    KEY(APPLICATION_ID),\n        UNIQUE (NAME,SUBSCRIBER_ID),\n        UNIQUE (UUID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS AM_API (\n        API_ID INTEGER
    AUTO_INCREMENT,\n        API_PROVIDER VARCHAR(200),\n        API_NAME VARCHAR(200),\n
    \       API_VERSION VARCHAR(30),\n        CONTEXT VARCHAR(256),\n        CONTEXT_TEMPLATE
    VARCHAR(256),\n        API_TIER VARCHAR(256),\n        API_TYPE VARCHAR(10),\n
    \       CREATED_BY VARCHAR(100),\n        CREATED_TIME TIMESTAMP,\n        UPDATED_BY
    VARCHAR(100),\n        UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        PRIMARY
    KEY(API_ID),\n        UNIQUE (API_PROVIDER,API_NAME,API_VERSION)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING (\n        URL_MAPPING_ID
    INTEGER AUTO_INCREMENT,\n        API_ID INTEGER NOT NULL,\n        HTTP_METHOD
    VARCHAR(20) NULL,\n        AUTH_SCHEME VARCHAR(50) NULL,\n        URL_PATTERN
    VARCHAR(512) NULL,\n        THROTTLING_TIER varchar(512) DEFAULT NULL,\n        MEDIATION_SCRIPT
    BLOB,\n        PRIMARY KEY (URL_MAPPING_ID)\n    )ENGINE INNODB;\n    CREATE TABLE
    IF NOT EXISTS AM_API_PRODUCT_MAPPING (\n    \tAPI_PRODUCT_MAPPING_ID INTEGER AUTO_INCREMENT,\n
    \   \tAPI_ID INTEGER,\n    \tURL_MAPPING_ID INTEGER,\n    \tFOREIGN KEY (API_ID)
    REFERENCES AM_API(API_ID) ON DELETE CASCADE,\n    \tFOREIGN KEY (URL_MAPPING_ID)
    REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE,\n    \tPRIMARY
    KEY(API_PRODUCT_MAPPING_ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    AM_SUBSCRIPTION (\n        SUBSCRIPTION_ID INTEGER AUTO_INCREMENT,\n        TIER_ID
    VARCHAR(50),\n        API_ID INTEGER,\n        LAST_ACCESSED TIMESTAMP NULL,\n
    \       APPLICATION_ID INTEGER,\n        SUB_STATUS VARCHAR(50),\n        SUBS_CREATE_STATE
    VARCHAR(50) DEFAULT 'SUBSCRIBE',\n        CREATED_BY VARCHAR(100),\n        CREATED_TIME
    TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        UPDATED_BY VARCHAR(100),\n        UPDATED_TIME
    TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n        UUID VARCHAR(256),\n        FOREIGN
    KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE
    ON DELETE RESTRICT,\n        FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON
    UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY KEY (SUBSCRIPTION_ID),\n        UNIQUE
    (UUID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING
    (\n        SUBSCRIPTION_ID INTEGER,\n        ACCESS_TOKEN VARCHAR(512),\n        KEY_TYPE
    VARCHAR(512) NOT NULL,\n        FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID)
    ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN)\n
    \   )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING
    (\n        APPLICATION_ID INTEGER,\n        CONSUMER_KEY VARCHAR(255),\n        KEY_TYPE
    VARCHAR(512) NOT NULL,\n        STATE VARCHAR(30) NOT NULL,\n        CREATE_MODE
    VARCHAR(30) DEFAULT 'CREATED',\n        FOREIGN KEY(APPLICATION_ID) REFERENCES
    AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY
    KEY(APPLICATION_ID,KEY_TYPE)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    AM_API_LC_EVENT (\n        EVENT_ID INTEGER AUTO_INCREMENT,\n        API_ID INTEGER
    NOT NULL,\n        PREVIOUS_STATE VARCHAR(50),\n        NEW_STATE VARCHAR(50)
    NOT NULL,\n        USER_ID VARCHAR(255) NOT NULL,\n        TENANT_ID INTEGER NOT
    NULL,\n        EVENT_DATE TIMESTAMP NOT NULL,\n        FOREIGN KEY(API_ID) REFERENCES
    AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY KEY (EVENT_ID)\n
    \   )ENGINE INNODB;\n    CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING (\n        CONSUMER_KEY
    VARCHAR(255),\n        AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL',\n        PRIMARY
    KEY (CONSUMER_KEY,AUTHZ_DOMAIN)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT
    EXISTS AM_API_COMMENTS (\n        COMMENT_ID VARCHAR(255) NOT NULL,\n        COMMENT_TEXT
    VARCHAR(512),\n        COMMENTED_USER VARCHAR(255),\n        DATE_COMMENTED TIMESTAMP
    NOT NULL,\n        API_ID INTEGER,\n        FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID)
    ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY KEY (COMMENT_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_API_RATINGS (\n        RATING_ID VARCHAR(255)
    NOT NULL,\n        API_ID INTEGER,\n        RATING INTEGER,\n        SUBSCRIBER_ID
    INTEGER,\n        FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE
    ON DELETE RESTRICT,\n        FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID)
    ON UPDATE CASCADE ON DELETE RESTRICT,\n    PRIMARY KEY (RATING_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS (\n        TIER_PERMISSIONS_ID
    INTEGER AUTO_INCREMENT,\n        TIER VARCHAR(50) NOT NULL,\n        PERMISSIONS_TYPE
    VARCHAR(50) NOT NULL,\n        ROLES VARCHAR(512) NOT NULL,\n        TENANT_ID
    INTEGER NOT NULL,\n        PRIMARY KEY(TIER_PERMISSIONS_ID)\n    )ENGINE INNODB;\n
    \   CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES (\n        APISTORE_ID INTEGER
    AUTO_INCREMENT,\n        API_ID INTEGER,\n        STORE_ID VARCHAR(255) NOT NULL,\n
    \       STORE_DISPLAY_NAME VARCHAR(255) NOT NULL,\n        STORE_ENDPOINT VARCHAR(255)
    NOT NULL,\n        STORE_TYPE VARCHAR(255) NOT NULL,\n        LAST_UPDATED_TIME
    TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID)
    ON UPDATE CASCADE ON DELETE RESTRICT,\n    PRIMARY KEY (APISTORE_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_WORKFLOWS(\n        WF_ID INTEGER AUTO_INCREMENT,\n
    \       WF_REFERENCE VARCHAR(255) NOT NULL,\n        WF_TYPE VARCHAR(255) NOT
    NULL,\n        WF_STATUS VARCHAR(255) NOT NULL,\n        WF_CREATED_TIME TIMESTAMP,\n
    \       WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    ,\n        WF_STATUS_DESC VARCHAR(1000),\n        TENANT_ID INTEGER,\n        TENANT_DOMAIN
    VARCHAR(255),\n        WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL,\n        PRIMARY
    KEY (WF_ID),\n        UNIQUE (WF_EXTERNAL_REFERENCE)\n    )ENGINE INNODB;\n    CREATE
    TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION (\n        REG_ID INT AUTO_INCREMENT,\n
    \       SUBSCRIBER_ID INT,\n        WF_REF VARCHAR(255) NOT NULL,\n        APP_ID
    INT,\n        TOKEN_TYPE VARCHAR(30),\n        TOKEN_SCOPE VARCHAR(1500) DEFAULT
    'default',\n        INPUTS VARCHAR(1000),\n        ALLOWED_DOMAINS VARCHAR(256),\n
    \       VALIDITY_PERIOD BIGINT,\n        UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE),\n
    \       FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON
    UPDATE CASCADE ON DELETE RESTRICT,\n        FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID)
    ON UPDATE CASCADE ON DELETE RESTRICT,\n        PRIMARY KEY (REG_ID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_API_SCOPES (\n       API_ID  INTEGER
    NOT NULL,\n       SCOPE_ID  INTEGER NOT NULL,\n       FOREIGN KEY (API_ID) REFERENCES
    AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,\n       FOREIGN KEY (SCOPE_ID)
    REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE,\n
    \      PRIMARY KEY (API_ID, SCOPE_ID)\n    )ENGINE = INNODB;\n    CREATE TABLE
    IF NOT EXISTS AM_API_DEFAULT_VERSION (\n                DEFAULT_VERSION_ID INT
    AUTO_INCREMENT,\n                API_NAME VARCHAR(256) NOT NULL ,\n                API_PROVIDER
    VARCHAR(256) NOT NULL ,\n                DEFAULT_API_VERSION VARCHAR(30) ,\n                PUBLISHED_DEFAULT_API_VERSION
    VARCHAR(30) ,\n                PRIMARY KEY (DEFAULT_VERSION_ID)\n    )ENGINE =
    INNODB;\n    CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);\n
    \   CREATE TABLE IF NOT EXISTS AM_MONETIZATION_USAGE (\n    \tID VARCHAR(100)
    NOT NULL,\n    \tSTATE VARCHAR(50) NOT NULL,\n    \tSTATUS VARCHAR(50) NOT NULL,\n
    \   \tSTARTED_TIME VARCHAR(50) NOT NULL,\n    \tPUBLISHED_TIME VARCHAR(50) NOT
    NULL,\n    \tPRIMARY KEY(ID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    AM_ALERT_TYPES (\n                ALERT_TYPE_ID INTEGER AUTO_INCREMENT,\n                ALERT_TYPE_NAME
    VARCHAR(255) NOT NULL ,\n    \t    STAKE_HOLDER VARCHAR(100) NOT NULL,\n                PRIMARY
    KEY (ALERT_TYPE_ID)\n    )ENGINE = INNODB;\n    CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES_VALUES
    (\n                ALERT_TYPE_ID INTEGER,\n                USER_NAME VARCHAR(255)
    NOT NULL ,\n    \t    STAKE_HOLDER VARCHAR(100) NOT NULL ,\n                PRIMARY
    KEY (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)\n    )ENGINE = INNODB;\n    CREATE
    TABLE IF NOT EXISTS AM_ALERT_EMAILLIST (\n    \t    EMAIL_LIST_ID INTEGER AUTO_INCREMENT,\n
    \               USER_NAME VARCHAR(255) NOT NULL ,\n    \t    STAKE_HOLDER VARCHAR(100)
    NOT NULL ,\n                PRIMARY KEY (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER)\n
    \   )ENGINE = INNODB;\n    CREATE TABLE IF NOT EXISTS  AM_ALERT_EMAILLIST_DETAILS
    (\n                EMAIL_LIST_ID INTEGER,\n    \t    EMAIL VARCHAR(255),\n                PRIMARY
    KEY (EMAIL_LIST_ID,EMAIL)\n    )ENGINE = INNODB;\n    INSERT INTO AM_ALERT_TYPES
    (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalResponseTime', 'publisher');\n
    \   INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalBackendTime',
    'publisher');\n    INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER)
    VALUES ('AbnormalRequestsPerMin', 'subscriber');\n    INSERT INTO AM_ALERT_TYPES
    (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRequestPattern', 'subscriber');\n
    \   INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccess',
    'subscriber');\n    INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER)
    VALUES ('FrequentTierLimitHitting', 'subscriber');\n    INSERT INTO AM_ALERT_TYPES
    (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('ApiHealthMonitor', 'publisher');\n    --
    AM Throttling tables --\n    CREATE TABLE IF NOT EXISTS AM_POLICY_SUBSCRIPTION
    (\n                POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,\n                NAME
    VARCHAR(512) NOT NULL,\n                DISPLAY_NAME VARCHAR(512) NULL DEFAULT
    NULL,\n                TENANT_ID INT(11) NOT NULL,\n                DESCRIPTION
    VARCHAR(1024) NULL DEFAULT NULL,\n                QUOTA_TYPE VARCHAR(25) NOT NULL,\n
    \               QUOTA INT(11) NOT NULL,\n                QUOTA_UNIT VARCHAR(10)
    NULL,\n                UNIT_TIME INT(11) NOT NULL,\n                TIME_UNIT
    VARCHAR(25) NOT NULL,\n                RATE_LIMIT_COUNT INT(11) NULL DEFAULT NULL,\n
    \               RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,\n                IS_DEPLOYED
    TINYINT(1) NOT NULL DEFAULT 0,\n    \t    CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,\n
    \               STOP_ON_QUOTA_REACH BOOLEAN NOT NULL DEFAULT 0,\n                BILLING_PLAN
    VARCHAR(20) NOT NULL,\n                UUID VARCHAR(256),\n                MONETIZATION_PLAN
    VARCHAR(25) NULL DEFAULT NULL,\n                FIXED_RATE VARCHAR(15) NULL DEFAULT
    NULL,\n                BILLING_CYCLE VARCHAR(15) NULL DEFAULT NULL,\n                PRICE_PER_REQUEST
    VARCHAR(15) NULL DEFAULT NULL,\n                CURRENCY VARCHAR(15) NULL DEFAULT
    NULL,\n                PRIMARY KEY (POLICY_ID),\n                UNIQUE INDEX
    AM_POLICY_SUBSCRIPTION_NAME_TENANT (NAME, TENANT_ID),\n                UNIQUE
    (UUID)\n    )ENGINE = InnoDB;\n    CREATE TABLE IF NOT EXISTS AM_POLICY_APPLICATION
    (\n                POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,\n                NAME
    VARCHAR(512) NOT NULL,\n                DISPLAY_NAME VARCHAR(512) NULL DEFAULT
    NULL,\n                TENANT_ID INT(11) NOT NULL,\n                DESCRIPTION
    VARCHAR(1024) NULL DEFAULT NULL,\n                QUOTA_TYPE VARCHAR(25) NOT NULL,\n
    \               QUOTA INT(11) NOT NULL,\n                QUOTA_UNIT VARCHAR(10)
    NULL DEFAULT NULL,\n                UNIT_TIME INT(11) NOT NULL,\n                TIME_UNIT
    VARCHAR(25) NOT NULL,\n                IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT
    0,\n    \t    CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,\n    \t          UUID VARCHAR(256),\n
    \               PRIMARY KEY (POLICY_ID),\n                UNIQUE INDEX APP_NAME_TENANT
    (NAME, TENANT_ID),\n                UNIQUE (UUID)\n    )ENGINE = InnoDB;\n    CREATE
    TABLE IF NOT EXISTS AM_POLICY_HARD_THROTTLING (\n                POLICY_ID INT(11)
    NOT NULL AUTO_INCREMENT,\n                NAME VARCHAR(512) NOT NULL,\n                TENANT_ID
    INT(11) NOT NULL,\n                DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,\n
    \               QUOTA_TYPE VARCHAR(25) NOT NULL,\n                QUOTA INT(11)
    NOT NULL,\n                QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,\n                UNIT_TIME
    INT(11) NOT NULL,\n                TIME_UNIT VARCHAR(25) NOT NULL,\n                IS_DEPLOYED
    TINYINT(1) NOT NULL DEFAULT 0,\n                PRIMARY KEY (POLICY_ID),\n                UNIQUE
    INDEX POLICY_HARD_NAME_TENANT (NAME, TENANT_ID)\n    )ENGINE = InnoDB;\n    CREATE
    TABLE IF NOT EXISTS AM_API_THROTTLE_POLICY (\n                POLICY_ID INT(11)
    NOT NULL AUTO_INCREMENT,\n                NAME VARCHAR(512) NOT NULL,\n                DISPLAY_NAME
    VARCHAR(512) NULL DEFAULT NULL,\n                TENANT_ID INT(11) NOT NULL,\n
    \               DESCRIPTION VARCHAR (1024),\n                DEFAULT_QUOTA_TYPE
    VARCHAR(25) NOT NULL,\n                DEFAULT_QUOTA INTEGER NOT NULL,\n                DEFAULT_QUOTA_UNIT
    VARCHAR(10) NULL,\n                DEFAULT_UNIT_TIME INTEGER NOT NULL,\n                DEFAULT_TIME_UNIT
    VARCHAR(25) NOT NULL,\n                APPLICABLE_LEVEL VARCHAR(25) NOT NULL,\n
    \               IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,\n                UUID
    VARCHAR(256),\n                PRIMARY KEY (POLICY_ID),\n                UNIQUE
    INDEX API_NAME_TENANT (NAME, TENANT_ID),\n                UNIQUE (UUID)\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_CONDITION_GROUP (\n                CONDITION_GROUP_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                POLICY_ID INTEGER NOT NULL,\n
    \               QUOTA_TYPE VARCHAR(25),\n                QUOTA INTEGER NOT NULL,\n
    \               QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,\n                UNIT_TIME
    INTEGER NOT NULL,\n                TIME_UNIT VARCHAR(25) NOT NULL,\n                DESCRIPTION
    VARCHAR (1024) NULL DEFAULT NULL,\n                PRIMARY KEY (CONDITION_GROUP_ID),\n
    \               FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID)
    ON DELETE CASCADE ON UPDATE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF
    NOT EXISTS AM_QUERY_PARAMETER_CONDITION (\n                QUERY_PARAMETER_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                CONDITION_GROUP_ID INTEGER NOT
    NULL,\n                PARAMETER_NAME VARCHAR(255) DEFAULT NULL,\n                PARAMETER_VALUE
    VARCHAR(255) DEFAULT NULL,\n    \t    \tIS_PARAM_MAPPING BOOLEAN DEFAULT 1,\n
    \               PRIMARY KEY (QUERY_PARAMETER_ID),\n                FOREIGN KEY
    (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE
    CASCADE ON UPDATE CASCADE\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS
    AM_HEADER_FIELD_CONDITION (\n                HEADER_FIELD_ID INTEGER NOT NULL
    AUTO_INCREMENT,\n                CONDITION_GROUP_ID INTEGER NOT NULL,\n                HEADER_FIELD_NAME
    VARCHAR(255) DEFAULT NULL,\n                HEADER_FIELD_VALUE VARCHAR(255) DEFAULT
    NULL,\n    \t    \tIS_HEADER_FIELD_MAPPING BOOLEAN DEFAULT 1,\n                PRIMARY
    KEY (HEADER_FIELD_ID),\n                FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES
    AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_JWT_CLAIM_CONDITION (\n                JWT_CLAIM_ID
    INTEGER NOT NULL AUTO_INCREMENT,\n                CONDITION_GROUP_ID INTEGER NOT
    NULL,\n                CLAIM_URI VARCHAR(512) DEFAULT NULL,\n                CLAIM_ATTRIB
    VARCHAR(1024) DEFAULT NULL,\n    \t    IS_CLAIM_MAPPING BOOLEAN DEFAULT 1,\n                PRIMARY
    KEY (JWT_CLAIM_ID),\n                FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES
    AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE\n    )ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_IP_CONDITION (\n      AM_IP_CONDITION_ID
    INT NOT NULL AUTO_INCREMENT,\n      STARTING_IP VARCHAR(45) NULL,\n      ENDING_IP
    VARCHAR(45) NULL,\n      SPECIFIC_IP VARCHAR(45) NULL,\n      WITHIN_IP_RANGE
    BOOLEAN DEFAULT 1,\n      CONDITION_GROUP_ID INT NULL,\n      PRIMARY KEY (AM_IP_CONDITION_ID),\n
    \     INDEX fk_AM_IP_CONDITION_1_idx (CONDITION_GROUP_ID ASC),  CONSTRAINT fk_AM_IP_CONDITION_1
    \   FOREIGN KEY (CONDITION_GROUP_ID)\n        REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID)
    \  ON DELETE CASCADE ON UPDATE CASCADE)\n    ENGINE = InnoDB;\n    CREATE TABLE
    IF NOT EXISTS AM_POLICY_GLOBAL (\n                POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,\n
    \               NAME VARCHAR(512) NOT NULL,\n                KEY_TEMPLATE VARCHAR(512)
    NOT NULL,\n                TENANT_ID INT(11) NOT NULL,\n                DESCRIPTION
    VARCHAR(1024) NULL DEFAULT NULL,\n                SIDDHI_QUERY BLOB DEFAULT NULL,\n
    \               IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,\n                UUID
    VARCHAR(256),\n                PRIMARY KEY (POLICY_ID),\n                UNIQUE
    (UUID)\n    )ENGINE INNODB;\n    CREATE TABLE IF NOT EXISTS AM_THROTTLE_TIER_PERMISSIONS
    (\n      THROTTLE_TIER_PERMISSIONS_ID INT NOT NULL AUTO_INCREMENT,\n      TIER
    VARCHAR(50) NULL,\n      PERMISSIONS_TYPE VARCHAR(50) NULL,\n      ROLES VARCHAR(512)
    NULL,\n      TENANT_ID INT(11) NULL,\n      PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID))\n
    \   ENGINE = InnoDB;\n    CREATE TABLE `AM_BLOCK_CONDITIONS` (\n      `CONDITION_ID`
    int(11) NOT NULL AUTO_INCREMENT,\n      `TYPE` varchar(45) DEFAULT NULL,\n      `VALUE`
    varchar(512) DEFAULT NULL,\n      `ENABLED` varchar(45) DEFAULT NULL,\n      `DOMAIN`
    varchar(45) DEFAULT NULL,\n      `UUID` VARCHAR(256),\n      PRIMARY KEY (`CONDITION_ID`),\n
    \     UNIQUE (`UUID`)\n    ) ENGINE=InnoDB;\n    CREATE TABLE IF NOT EXISTS `AM_CERTIFICATE_METADATA`
    (\n      `TENANT_ID` INT(11) NOT NULL,\n      `ALIAS` VARCHAR(45) NOT NULL,\n
    \     `END_POINT` VARCHAR(100) NOT NULL,\n      CONSTRAINT PK_ALIAS PRIMARY KEY
    (`ALIAS`)\n    ) ENGINE=InnoDB;\n    CREATE TABLE IF NOT EXISTS `AM_API_CLIENT_CERTIFICATE`
    (\n      `TENANT_ID` INT(11) NOT NULL,\n      `ALIAS` VARCHAR(45) NOT NULL,\n
    \     `API_ID` INTEGER NOT NULL,\n      `CERTIFICATE` BLOB NOT NULL,\n      `REMOVED`
    BOOLEAN NOT NULL DEFAULT 0,\n      `TIER_NAME` VARCHAR (512),\n      FOREIGN KEY
    (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,\n      PRIMARY
    KEY (`ALIAS`, `TENANT_ID`, `REMOVED`)\n    ) ENGINE=InnoDB;\n    CREATE TABLE
    IF NOT EXISTS AM_APPLICATION_GROUP_MAPPING (\n        APPLICATION_ID INTEGER NOT
    NULL,\n        GROUP_ID VARCHAR(512) NOT NULL,\n        TENANT VARCHAR(255),\n
    \       PRIMARY KEY (APPLICATION_ID,GROUP_ID,TENANT),\n        FOREIGN KEY (APPLICATION_ID)
    REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE\n
    \   ) ENGINE=InnoDB;\n    CREATE TABLE IF NOT EXISTS AM_USAGE_UPLOADED_FILES (\n
    \     TENANT_DOMAIN varchar(255) NOT NULL,\n      FILE_NAME varchar(255) NOT NULL,\n
    \     FILE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n      FILE_PROCESSED
    tinyint(1) DEFAULT FALSE,\n      FILE_CONTENT MEDIUMBLOB DEFAULT NULL,\n      PRIMARY
    KEY (TENANT_DOMAIN, FILE_NAME, FILE_TIMESTAMP)\n    ) ENGINE=InnoDB;\n    CREATE
    TABLE IF NOT EXISTS AM_API_LC_PUBLISH_EVENTS (\n        ID INTEGER(11) NOT NULL
    AUTO_INCREMENT,\n        TENANT_DOMAIN VARCHAR(500) NOT NULL,\n        API_ID
    VARCHAR(500) NOT NULL,\n        EVENT_TIME TIMESTAMP NOT NULL,\n        PRIMARY
    KEY (ID)\n    ) ENGINE=InnoDB;\n    CREATE TABLE IF NOT EXISTS AM_APPLICATION_ATTRIBUTES
    (\n      APPLICATION_ID int(11) NOT NULL,\n      NAME varchar(255) NOT NULL,\n
    \     VALUE varchar(1024) NOT NULL,\n      TENANT_ID int(11) NOT NULL,\n      PRIMARY
    KEY (APPLICATION_ID,NAME),\n      FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION
    (APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE\n    ) ENGINE=InnoDB;\n    CREATE
    TABLE IF NOT EXISTS AM_LABELS (\n      LABEL_ID VARCHAR(50),\n      NAME VARCHAR(255),\n
    \     DESCRIPTION VARCHAR(1024),\n      TENANT_DOMAIN VARCHAR(255),\n      UNIQUE
    (NAME,TENANT_DOMAIN),\n      PRIMARY KEY (LABEL_ID)\n    ) ENGINE=InnoDB;\n    CREATE
    TABLE IF NOT EXISTS AM_LABEL_URLS (\n      LABEL_ID VARCHAR(50),\n      ACCESS_URL
    VARCHAR(255),\n      PRIMARY KEY (LABEL_ID,ACCESS_URL),\n      FOREIGN KEY (LABEL_ID)
    REFERENCES AM_LABELS(LABEL_ID) ON UPDATE CASCADE ON DELETE CASCADE\n    ) ENGINE=InnoDB;\n
    \   CREATE TABLE IF NOT EXISTS AM_SYSTEM_APPS (\n        ID INTEGER AUTO_INCREMENT,\n
    \       NAME VARCHAR(50) NOT NULL,\n        CONSUMER_KEY VARCHAR(512) NOT NULL,\n
    \       CONSUMER_SECRET VARCHAR(512) NOT NULL,\n        CREATED_TIME TIMESTAMP
    DEFAULT CURRENT_TIMESTAMP,\n        UNIQUE (NAME),\n        UNIQUE (CONSUMER_KEY),\n
    \       PRIMARY KEY (ID)\n     ) ENGINE=InnoDB;\n    -- BotDATA Email table --\n
    \   CREATE TABLE IF NOT EXISTS AM_NOTIFICATION_SUBSCRIBER (\n        UUID VARCHAR(255),\n
    \       CATEGORY VARCHAR(255),\n        NOTIFICATION_METHOD VARCHAR(255),\n        SUBSCRIBER_ADDRESS
    VARCHAR(255) NOT NULL,\n        PRIMARY KEY(UUID, SUBSCRIBER_ADDRESS)\n    ) ENGINE
    INNODB;\n    CREATE TABLE IF NOT EXISTS AM_REVOKED_JWT (\n        UUID VARCHAR(255)
    NOT NULL,\n        SIGNATURE VARCHAR(2048) NOT NULL,\n        EXPIRY_TIMESTAMP
    BIGINT NOT NULL,\n        TENANT_ID INTEGER DEFAULT -1,\n        TOKEN_TYPE VARCHAR(15)
    DEFAULT 'DEFAULT',\n        TIME_CREATED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n
    \       PRIMARY KEY (UUID)\n    ) ENGINE=InnoDB;\n    -- End of API-MGT Tables
    --\n    -- Performance indexes start--\n    create index IDX_ITS_LMT on IDN_THRIFT_SESSION
    (LAST_MODIFIED_TIME);\n    create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN
    (USER_TYPE);\n    create index IDX_AAI_CTX on AM_API (CONTEXT);\n    create index
    IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY);\n    create index IDX_AAUM_AI
    on AM_API_URL_MAPPING (API_ID);\n    create index IDX_AAPM_AI on AM_API_PRODUCT_MAPPING
    (API_ID);\n    create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER);\n
    \   create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE);\n
    \   create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE);\n    create index
    IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE);\n    create index IDX_AS_AITIAI
    on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID);\n    create index IDX_APA_QT
    on AM_POLICY_APPLICATION (QUOTA_TYPE);\n    create index IDX_AA_AT_CB on AM_APPLICATION
    (APPLICATION_TIER,CREATED_BY);\n    -- Performance indexes end--"
kind: ConfigMap
metadata:
  creationTimestamp: "2019-12-05T06:58:28Z"
  name: wso2am-p1-mysql-dbscripts
  namespace: wso2-system
  resourceVersion: "1612269"
  selfLink: /api/v1/namespaces/wso2-system/configmap/mysql-dbscripts
  uid: ddd002d9-f24f-4eae-9fed-9609280049d1
