Merge branch 'application-mgt-new' into 'master'

Add PostgreSQL support for the App Manager

See merge request entgra/carbon-device-mgt!402
feature/appm-store/pbac
Charitha Goonetilleke 5 years ago
commit af1541e641

@ -26,10 +26,13 @@ import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO;
import org.wso2.carbon.device.application.mgt.core.dao.ReviewDAO; import org.wso2.carbon.device.application.mgt.core.dao.ReviewDAO;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO; import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO; import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.PostgreSQLApplicationDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.SQLServerApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.SQLServerApplicationDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationReleaseDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationReleaseDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.PostgreSQLApplicationReleaseDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.SQLServerApplicationReleaseDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.SQLServerApplicationReleaseDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.OracleLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.OracleLifecycleStateDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.PostgreSQLLifecycleStateDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.SQLServerLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.SQLServerLifecycleStateDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.review.GenericReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.GenericReviewDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl;
@ -37,12 +40,15 @@ import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.OracleApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.OracleApplicationDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.review.OracleReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.OracleReviewDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.review.PostgreSQLReviewDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.review.SQLServerReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.SQLServerReviewDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.GenericSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.GenericSubscriptionDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.OracleSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.OracleSubscriptionDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.PostgreSQLSubscriptionDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.SQLServerSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.SQLServerSubscriptionDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.GenericVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.GenericVisibilityDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.PostgreSQLVisibilityDAOImpl;
import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl;
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.Constants; import org.wso2.carbon.device.application.mgt.core.util.Constants;
@ -81,8 +87,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericApplicationDAOImpl(); return new GenericApplicationDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLApplicationDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:
return new SQLServerApplicationDAOImpl(); return new SQLServerApplicationDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
@ -99,8 +106,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericLifecycleStateDAOImpl(); return new GenericLifecycleStateDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLLifecycleStateDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:
return new SQLServerLifecycleStateDAOImpl(); return new SQLServerLifecycleStateDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
@ -122,8 +130,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericApplicationReleaseDAOImpl(); return new GenericApplicationReleaseDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLApplicationReleaseDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
return new OracleApplicationReleaseDAOImpl(); return new OracleApplicationReleaseDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:
@ -144,8 +153,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericVisibilityDAOImpl(); return new GenericVisibilityDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLVisibilityDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
return new OracleVisibilityDAOImpl(); return new OracleVisibilityDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:
@ -166,8 +176,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericSubscriptionDAOImpl(); return new GenericSubscriptionDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLSubscriptionDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
return new OracleSubscriptionDAOImpl(); return new OracleSubscriptionDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:
@ -184,8 +195,9 @@ public class ApplicationManagementDAOFactory {
switch (databaseEngine) { switch (databaseEngine) {
case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_H2:
case Constants.DataBaseTypes.DB_TYPE_MYSQL: case Constants.DataBaseTypes.DB_TYPE_MYSQL:
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new GenericReviewDAOImpl(); return new GenericReviewDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
return new PostgreSQLReviewDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_ORACLE: case Constants.DataBaseTypes.DB_TYPE_ORACLE:
return new OracleReviewDAOImpl(); return new OracleReviewDAOImpl();
case Constants.DataBaseTypes.DB_TYPE_MSSQL: case Constants.DataBaseTypes.DB_TYPE_MSSQL:

@ -0,0 +1,29 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.application;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles Application operations which are specific to MSSQL.
*/
public class PostgreSQLApplicationDAOImpl extends GenericApplicationDAOImpl {
private static final Log log = LogFactory.getLog(PostgreSQLApplicationDAOImpl.class);
}

@ -0,0 +1,28 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.application.release;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles Application Release operations which are specific to MSSQL.
*/
public class PostgreSQLApplicationReleaseDAOImpl extends GenericApplicationReleaseDAOImpl {
private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class);
}

@ -0,0 +1,30 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles App Lifecycle operations which are specific to MSSQL.
*/
public class PostgreSQLLifecycleStateDAOImpl extends GenericLifecycleStateDAOImpl{
private static final Log log = LogFactory.getLog(PostgreSQLLifecycleStateDAOImpl.class);
}

@ -0,0 +1,30 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.review;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles Application Review handling operations which are specific to MsSQL.
*/
public class PostgreSQLReviewDAOImpl extends GenericReviewDAOImpl {
private static final Log log = LogFactory.getLog(PostgreSQLReviewDAOImpl.class);
}

@ -0,0 +1,30 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.subscription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles Application subscribing operations which are specific to MsSQL.
*/
public class PostgreSQLSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
private static Log log = LogFactory.getLog(PostgreSQLSubscriptionDAOImpl.class);
}

@ -0,0 +1,30 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.visibility;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This handles Application visibility handling operations which are specific to MsSQL.
*/
public class PostgreSQLVisibilityDAOImpl extends GenericVisibilityDAOImpl {
private static Log log = LogFactory.getLog(PostgreSQLVisibilityDAOImpl.class);
}

@ -34,7 +34,7 @@ public class EnrolmentInfo implements Serializable {
} }
public enum OwnerShip { public enum OwnerShip {
BYOD, COPE BYOD, COPE, WORK_PROFILE, GOOGLE_ENTERPRISE
} }
@ApiModelProperty(name = "id", value = "ID of the device in the WSO2 EMM device information database.", @ApiModelProperty(name = "id", value = "ID of the device in the WSO2 EMM device information database.",

@ -0,0 +1,37 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import java.util.Map;
/**
* This implementation populates device type plugin management service.
*/
public interface DeviceTypeCommonService {
/**
* To get Enrollment QR code against Ownership type
*
* @return QR code Map, Key as Ownership Type and Value as QR string
* @throws DeviceManagementException if error occurred while generating the QR String for Ownership
*/
Map<EnrolmentInfo.OwnerShip, String> getEnrollmentQRCode() throws DeviceManagementException;
}

@ -1,279 +1,307 @@
DROP TABLE IF EXISTS APPM_PLATFORM; -- -----------------------------------------------------
DROP SEQUENCE IF EXISTS APPM_PLATFORM_PK_SEQ; -- Table AP_APP
CREATE SEQUENCE APPM_PLATFORM_PK_SEQ; -- -----------------------------------------------------
CREATE SEQUENCE AP_APP_seq;
CREATE TABLE APPM_PLATFORM (
ID INT DEFAULT NEXTVAL('APPM_PLATFORM_PK_SEQ') UNIQUE, CREATE TABLE IF NOT EXISTS AP_APP(
IDENTIFIER VARCHAR (100) NOT NULL, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_seq'),
TENANT_ID INT NOT NULL , NAME VARCHAR(350) NOT NULL,
NAME VARCHAR (255), DESCRIPTION VARCHAR(200) NOT NULL,
FILE_BASED BOOLEAN, TYPE VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(2048), TENANT_ID INTEGER NOT NULL,
IS_SHARED BOOLEAN, STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
IS_DEFAULT_TENANT_MAPPING BOOLEAN, SUB_TYPE VARCHAR(45) NOT NULL,
ICON_NAME VARCHAR (100), CURRENCY VARCHAR(45) NULL DEFAULT '$',
PRIMARY KEY (ID) RATING DOUBLE PRECISION NULL DEFAULT NULL,
DEVICE_TYPE_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
); );
DROP TABLE IF EXISTS APPM_PLATFORM_PROPERTIES; -- -----------------------------------------------------
DROP SEQUENCE IF EXISTS APPM_PLATFORM_PROPERTIES_PK_SEQ; -- Table AP_APP_RELEASE
CREATE SEQUENCE APPM_PLATFORM_PROPERTIES_PK_SEQ; -- -----------------------------------------------------
CREATE SEQUENCE AP_APP_RELEASE_seq;
CREATE TABLE APPM_PLATFORM_PROPERTIES (
ID INT DEFAULT NEXTVAL('APPM_PLATFORM_PROPERTIES_PK_SEQ'), CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
PLATFORM_ID INT NOT NULL, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_RELEASE_seq'),
PROP_NAME VARCHAR (100) NOT NULL, DESCRIPTION VARCHAR(200) NOT NULL,
OPTIONAL BOOLEAN, VERSION VARCHAR(70) NOT NULL,
DEFAUL_VALUE VARCHAR (255), TENANT_ID INTEGER NOT NULL,
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE, UUID VARCHAR(200) NOT NULL,
PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME) RELEASE_TYPE VARCHAR(45) NOT NULL,
PACKAGE_NAME VARCHAR(150) NOT NULL,
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
INSTALLER_LOCATION VARCHAR(100) NOT NULL,
ICON_LOCATION VARCHAR(100) NOT NULL,
BANNER_LOCATION VARCHAR(100) NULL DEFAULT NULL,
SC_1_LOCATION VARCHAR(100) NOT NULL,
SC_2_LOCATION VARCHAR(100) NULL DEFAULT NULL,
SC_3_LOCATION VARCHAR(100) NULL DEFAULT NULL,
APP_HASH_VALUE VARCHAR(1000) NOT NULL,
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
APP_META_INFO VARCHAR(150) NULL DEFAULT NULL,
SUPPORTED_OS_VERSIONS VARCHAR(45) NOT NULL,
RATING DOUBLE PRECISION NULL DEFAULT NULL,
CURRENT_STATE VARCHAR(45) NOT NULL,
RATED_USERS INTEGER NULL,
AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC);
DROP TABLE IF EXISTS APPM_PLATFORM_TENANT_MAPPING; -- -----------------------------------------------------
DROP SEQUENCE IF EXISTS APPM_PLATFORM_TENANT_MAPPING_PK_SEQ; -- Table AP_APP_REVIEW
CREATE SEQUENCE APPM_PLATFORM_TENANT_MAPPING_PK_SEQ; -- -----------------------------------------------------
CREATE SEQUENCE AP_APP_REVIEW_seq;
CREATE TABLE APPM_PLATFORM_TENANT_MAPPING (
ID INT DEFAULT NEXTVAL('APPM_PLATFORM_TENANT_MAPPING_PK_SEQ'), CREATE TABLE IF NOT EXISTS AP_APP_REVIEW(
TENANT_ID INT NOT NULL , ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_REVIEW_seq'),
PLATFORM_ID INT NOT NULL, TENANT_ID INTEGER NOT NULL,
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE, COMMENT TEXT NOT NULL,
PRIMARY KEY (ID, TENANT_ID, PLATFORM_ID) ROOT_PARENT_ID INTEGER NOT NULL,
IMMEDIATE_PARENT_ID INTEGER NOT NULL,
CREATED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL,
MODIFIED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL,
RATING INTEGER NULL,
USERNAME VARCHAR(45) NOT NULL,
ACTIVE_REVIEW BOOLEAN NOT NULL DEFAULT TRUE,
AP_APP_RELEASE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC);
CREATE INDEX FK_PLATFROM_TENANT_MAPPING_PLATFORM ON APPM_PLATFORM_TENANT_MAPPING(PLATFORM_ID ASC);
DROP TABLE IF EXISTS APPM_APPLICATION_CATEGORY;
DROP SEQUENCE IF EXISTS APPM_APPLICATION_CATEGORY_PK_SEQ;
CREATE SEQUENCE APPM_APPLICATION_CATEGORY_PK_SEQ;
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_CATEGORY (
ID INT DEFAULT NEXTVAL('APPM_APPLICATION_CATEGORY_PK_SEQ'),
NAME VARCHAR(100) NOT NULL,
DESCRIPTION TEXT NULL,
PUBLISHED BOOLEAN DEFAULT FALSE,
PRIMARY KEY (ID));
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION, PUBLISHED) VALUES ('Enterprise', 'Enterprise level
applications which the artifacts need to be provided', TRUE);
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION, PUBLISHED) VALUES ('Public', 'Public category in which the
application need to be downloaded from the public application store', TRUE);
DROP TABLE IF EXISTS APPM_LIFECYCLE_STATE;
DROP SEQUENCE IF EXISTS APPM_LIFECYCLE_STATE_PK_SEQ;
CREATE SEQUENCE APPM_LIFECYCLE_STATE_PK_SEQ;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_LIFECYCLE_STATE -- Table AP_APP_LIFECYCLE_STATE
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_LIFECYCLE_STATE ( CREATE SEQUENCE AP_APP_LIFECYCLE_STATE_seq;
ID INT DEFAULT NEXTVAL('APPM_LIFECYCLE_STATE_PK_SEQ'),
NAME VARCHAR(100) NOT NULL, CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE(
IDENTIFIER VARCHAR(100) NOT NULL, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_LIFECYCLE_STATE_seq'),
DESCRIPTION TEXT NULL, CURRENT_STATE VARCHAR(45) NOT NULL,
PRIMARY KEY (ID)); PREVIOUS_STATE VARCHAR(45) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DROP INDEX IF EXISTS APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE; UPDATED_BY VARCHAR(100) NOT NULL,
CREATE INDEX APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE ON APPM_LIFECYCLE_STATE(IDENTIFIER ASC); UPDATED_AT TIMESTAMP(0) NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL,
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) VALUES ('CREATED', 'CREATED', 'Application creation REASON TEXT DEFAULT NULL,
initial state'); PRIMARY KEY (ID),
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
VALUES ('IN REVIEW', 'IN REVIEW', 'Application is in in-review state'); FOREIGN KEY (AP_APP_RELEASE_ID)
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
VALUES ('APPROVED', 'APPROVED', 'State in which Application is approved after reviewing.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('REJECTED', 'REJECTED', 'State in which Application is rejected after reviewing.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('PUBLISHED', 'PUBLISHED', 'State in which Application is in published state.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('BLOCKED', 'BLOCKED', 'State in which Application is in un published state.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('RETIRED', 'RETIRED', 'Retiring an application to indicate end of life state,');
DROP TABLE IF EXISTS APPM_LC_STATE_TRANSITION;
DROP SEQUENCE IF EXISTS APPM_LC_STATE_TRANSITION_PK_SEQ;
CREATE SEQUENCE APPM_LC_STATE_TRANSITION_PK_SEQ;
CREATE TABLE IF NOT EXISTS APPM_LC_STATE_TRANSITION
(
ID INT DEFAULT NEXTVAL('APPM_LC_STATE_TRANSITION_PK_SEQ'),
INITIAL_STATE INT,
NEXT_STATE INT,
PERMISSION VARCHAR(1024),
DESCRIPTION VARCHAR(2048),
PRIMARY KEY (INITIAL_STATE, NEXT_STATE),
FOREIGN KEY (INITIAL_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE,
FOREIGN KEY (NEXT_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE
); );
CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC);
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES -- -----------------------------------------------------
(1, 2, null, 'Submit for review'); -- Table AP_APP_TAG
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES -- -----------------------------------------------------
(2, 1, null, 'Revoke from review'); CREATE SEQUENCE AP_APP_TAG_seq;
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 3, '/permission/admin/manage/device-mgt/application/review', 'APPROVE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(5, 6, null, 'UN PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(4, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 7, null, 'Retire');
DROP TABLE IF EXISTS APPM_APPLICATION; CREATE TABLE IF NOT EXISTS AP_APP_TAG(
DROP SEQUENCE IF EXISTS APPM_APPLICATION_PK_SEQ; ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_TAG_seq'),
CREATE SEQUENCE APPM_APPLICATION_PK_SEQ; TENANT_ID INTEGER NOT NULL,
TAG VARCHAR(100) NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS APPM_APPLICATION ( -- -----------------------------------------------------
ID INT DEFAULT NEXTVAL('APPM_APPLICATION_PK_SEQ') UNIQUE, -- Table AP_DEVICE_SUBSCRIPTION
UUID VARCHAR(100) NOT NULL, -- -----------------------------------------------------
NAME VARCHAR(100) NOT NULL, CREATE SEQUENCE AP_DEVICE_SUBSCRIPTION_seq;
SHORT_DESCRIPTION VARCHAR(255) NULL,
DESCRIPTION TEXT NULL, CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
SCREEN_SHOT_COUNT INT DEFAULT 0, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_DEVICE_SUBSCRIPTION_seq'),
VIDEO_NAME VARCHAR(100) NULL, TENANT_ID INTEGER NOT NULL,
CREATED_BY VARCHAR(255) NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
CREATED_AT TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL,
MODIFIED_AT TIMESTAMP NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
IS_FREE BOOLEAN DEFAULT TRUE, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
PAYMENT_CURRENCY VARCHAR(45) NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL,
PAYMENT_PRICE DECIMAL(10,2) NULL, ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
APPLICATION_CATEGORY_ID INT NOT NULL, STATUS VARCHAR(45) NOT NULL,
LIFECYCLE_STATE_ID INT NOT NULL, DM_DEVICE_ID INTEGER NOT NULL,
LIFECYCLE_STATE_MODIFIED_BY VARCHAR(255) NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
LIFECYCLE_STATE_MODIFIED_AT TIMESTAMP NULL, PRIMARY KEY (ID),
TENANT_ID INT NOT NULL, CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
PLATFORM_ID INT NOT NULL, FOREIGN KEY (AP_APP_RELEASE_ID)
PRIMARY KEY (ID, APPLICATION_CATEGORY_ID, LIFECYCLE_STATE_ID, PLATFORM_ID), REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
FOREIGN KEY (APPLICATION_CATEGORY_ID) );
REFERENCES APPM_APPLICATION_CATEGORY (ID) CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_APPM_APPLICATION_APPM_LIFECYCLE_STATE1
FOREIGN KEY (LIFECYCLE_STATE_ID)
REFERENCES APPM_LIFECYCLE_STATE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_APPM_APPLICATION_APPM_PLATFORM1
FOREIGN KEY (PLATFORM_ID)
REFERENCES APPM_PLATFORM (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX IF NOT EXISTS FK_APPLICATION_APPLICATION_CATEGORY ON APPM_APPLICATION(APPLICATION_CATEGORY_ID ASC); -- -----------------------------------------------------
CREATE INDEX IF NOT EXISTS UK_APPLICATION_UUID ON APPM_APPLICATION(UUID ASC); -- Table AP_GROUP_SUBSCRIPTION
-- -----------------------------------------------------
CREATE SEQUENCE AP_GROUP_SUBSCRIPTION_seq;
CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_GROUP_SUBSCRIPTION_seq'),
TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL,
UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL,
GROUP_NAME VARCHAR(100) NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
DROP TABLE IF EXISTS APPM_APPLICATION_PROPERTY;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_APPLICATION_PROPERTY -- Table AP_ROLE_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTY ( CREATE SEQUENCE AP_ROLE_SUBSCRIPTION_seq;
PROP_KEY VARCHAR(255) NOT NULL,
PROP_VAL TEXT NULL, CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION(
APPLICATION_ID INT NOT NULL, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_ROLE_SUBSCRIPTION_seq'),
PRIMARY KEY (PROP_KEY, APPLICATION_ID), TENANT_ID INTEGER NOT NULL,
CONSTRAINT FK_APPLICATION_PROPERTY_APPLICATION ROLE_NAME VARCHAR(100) NOT NULL,
FOREIGN KEY (APPLICATION_ID) SUBSCRIBED_BY VARCHAR(100) NOT NULL,
REFERENCES APPM_APPLICATION (ID) SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL,
ON DELETE NO ACTION UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
ON UPDATE NO ACTION); UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
CREATE INDEX FK_APPLICATION_PROPERTY_APPLICATION ON APPM_APPLICATION_PROPERTY(APPLICATION_ID ASC); -- -----------------------------------------------------
-- Table AP_UNRESTRICTED_ROLE
-- -----------------------------------------------------
CREATE SEQUENCE AP_UNRESTRICTED_ROLE_seq;
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_TAG ( CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE(
NAME VARCHAR(45) NOT NULL, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_UNRESTRICTED_ROLE_seq'),
APPLICATION_ID INT NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (APPLICATION_ID, NAME), ROLE VARCHAR(45) NOT NULL,
CONSTRAINT fk_APPM_APPLICATION_TAG_APPM_APPLICATION1 AP_APP_ID INTEGER NOT NULL,
FOREIGN KEY (APPLICATION_ID) PRIMARY KEY (ID),
REFERENCES APPM_APPLICATION (ID) CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
ON DELETE NO ACTION FOREIGN KEY (AP_APP_ID)
ON UPDATE NO ACTION); REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID ASC);
CREATE INDEX IF NOT EXISTS FK_APPLICATION_TAG_APPLICATION ON APPM_APPLICATION_TAG(APPLICATION_ID ASC); -- -----------------------------------------------------
-- Table AP_USER_SUBSCRIPTION
-- -----------------------------------------------------
CREATE SEQUENCE AP_USER_SUBSCRIPTION_seq;
CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_USER_SUBSCRIPTION_seq'),
TENANT_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL,
UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
CREATE TABLE IF NOT EXISTS APPM_PLATFORM_TAG ( -- -----------------------------------------------------
NAME VARCHAR(100) NOT NULL, -- Table AP_APP_CATEGORY
PLATFORM_ID INT NOT NULL, -- -----------------------------------------------------
PRIMARY KEY (PLATFORM_ID, NAME), CREATE SEQUENCE AP_APP_CATEGORY_seq;
CONSTRAINT fk_APPM_PLATFORM_TAG_APPM_APPLICATION1
FOREIGN KEY (PLATFORM_ID) CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY(
REFERENCES APPM_PLATFORM (ID) ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_CATEGORY_seq'),
ON DELETE CASCADE TENANT_ID INTEGER NOT NULL,
ON UPDATE CASCADE); CATEGORY VARCHAR(45) NOT NULL,
CATEGORY_ICON VARCHAR(45) NULL,
PRIMARY KEY (ID)
);
DROP TABLE IF EXISTS APPM_APPLICATION_RELEASE;
DROP SEQUENCE IF EXISTS APPM_APPLICATION_RELEASE_PK_SEQ;
CREATE SEQUENCE APPM_APPLICATION_RELEASE_PK_SEQ;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_APPLICATION_RELEASE -- Table AP_APP_TAG_MAPPING
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_RELEASE ( CREATE SEQUENCE AP_APP_TAG_MAPPING_seq;
ID INT DEFAULT NEXTVAL('APPM_APPLICATION_RELEASE_PK_SEQ') UNIQUE,
VERSION_NAME VARCHAR(70) NOT NULL,
RELEASE_RESOURCE TEXT NULL,
RELEASE_CHANNEL VARCHAR(50) DEFAULT 'ALPHA',
RELEASE_DETAILS TEXT NULL,
CREATED_AT TIMESTAMP NOT NULL,
APPM_APPLICATION_ID INT NOT NULL,
IS_DEFAULT BOOLEAN DEFAULT FALSE,
PRIMARY KEY (APPM_APPLICATION_ID, VERSION_NAME),
CONSTRAINT FK_APPLICATION_VERSION_APPLICATION
FOREIGN KEY (APPM_APPLICATION_ID)
REFERENCES APPM_APPLICATION (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_APPLICATION_VERSION_APPLICATION ON APPM_APPLICATION_RELEASE(APPM_APPLICATION_ID ASC); CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING(
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_TAG_MAPPING_seq'),
TENANT_ID INTEGER NOT NULL,
AP_APP_TAG_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1
FOREIGN KEY (AP_APP_TAG_ID)
REFERENCES AP_APP_TAG (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx ON AP_APP_TAG_MAPPING (AP_APP_TAG_ID ASC);
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID ASC);
DROP TABLE IF EXISTS APPM_RELEASE_PROPERTY;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_RELEASE_PROPERTY -- Table AP_APP_CATEGORY_MAPPING
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_RELEASE_PROPERTY ( CREATE SEQUENCE AP_APP_CATEGORY_MAPPING_seq;
PROP_KEY VARCHAR(255) NOT NULL,
PROP_VALUE TEXT NULL,
APPLICATION_RELEASE_ID INT NOT NULL,
PRIMARY KEY (PROP_KEY, APPLICATION_RELEASE_ID),
CONSTRAINT FK_RELEASE_PROPERTY_APPLICATION_RELEASE
FOREIGN KEY (APPLICATION_RELEASE_ID)
REFERENCES APPM_APPLICATION_RELEASE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_RELEASE_PROPERTY_APPLICATION_RELEASE ON APPM_RELEASE_PROPERTY(APPLICATION_RELEASE_ID ASC); CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING(
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_CATEGORY_MAPPING_seq'),
TENANT_ID INTEGER NOT NULL,
AP_APP_CATEGORY_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1
FOREIGN KEY (AP_APP_CATEGORY_ID)
REFERENCES AP_APP_CATEGORY (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_CATEGORY_ID ASC);
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_APP_SUB_OP_MAPPING
-- -----------------------------------------------------
CREATE SEQUENCE AP_APP_SUB_OP_MAPPING_seq;
DROP TABLE IF EXISTS AP_SCHEDULED_SUBSCRIPTION; CREATE TABLE IF NOT EXISTS AP_APP_SUB_OP_MAPPING (
DROP SEQUENCE IF EXISTS APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ; ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_SUB_OP_MAPPING_seq'),
CREATE SEQUENCE APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ; TENANT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
AP_DEVICE_SUBSCRIPTION_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1
FOREIGN KEY (AP_DEVICE_SUBSCRIPTION_ID)
REFERENCES AP_DEVICE_SUBSCRIPTION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_OP_MAPPING (AP_DEVICE_SUBSCRIPTION_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_SCHEDULED_SUBSCRIPTION -- Table AP_SCHEDULED_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE SEQUENCE AP_SCHEDULED_SUBSCRIPTION_seq;
CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
ID INT DEFAULT NEXTVAL('APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ') UNIQUE, ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_SCHEDULED_SUBSCRIPTION_seq'),
TASK_NAME VARCHAR(100) NOT NULL, TASK_NAME VARCHAR(100) NOT NULL,
APPLICATION_UUID VARCHAR(36) NOT NULL, APPLICATION_UUID VARCHAR(36) NOT NULL,
SUBSCRIBER_LIST VARCHAR NOT NULL, SUBSCRIBER_LIST TEXT NOT NULL,
STATUS VARCHAR(15) NOT NULL, STATUS VARCHAR(15) NOT NULL,
SCHEDULED_AT TIMESTAMP NOT NULL, SCHEDULED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL,
SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL,
SCHEDULED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, SCHEDULED_TIMESTAMP TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL,
DELETED BOOLEAN NOT NULL DEFAULT FALSE DELETED BOOLEAN,
PRIMARY KEY (ID), PRIMARY KEY (ID)
CONSTRAINT FK_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE
FOREIGN KEY (APPLICATION_UUID)
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );

Loading…
Cancel
Save