diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml index c69b51b1c41..25be8fb3fca 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml @@ -40,11 +40,11 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.core - + @@ -95,9 +95,7 @@ - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version} - + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index d512eafa36f..389467a7d33 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -5,14 +5,14 @@ CREATE TABLE IF NOT EXISTS APPM_APPLICATION_TYPE ( CODE VARCHAR (255), PARAMTERS LONGTEXT, PRIMARY KEY (ID) -)ENGINE INNODB; +); CREATE TABLE IF NOT EXISTS APPM_APPLICATION_CATEGORY ( ID INTEGER AUTO_INCREMENT, NAME VARCHAR (255), DESCRIPTION TEXT, PRIMARY KEY (ID) -)ENGINE INNODB; +); CREATE TABLE IF NOT EXISTS APPM_APPLICATION ( @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS APPM_APPLICATION ( PRIMARY KEY (ID), FOREIGN KEY (CATEGORY_ID) REFERENCES APPM_APPLICATION_CATEGORY(ID), FOREIGN KEY (APPLICATION_TYPE_ID) REFERENCES APPM_APPLICATION_TYPE(ID) -)ENGINE INNODB; +); CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTIES ( @@ -41,4 +41,4 @@ CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTIES ( APPLICATION_ID INTEGER, PRIMARY KEY (APPLICATION_ID, PROP_KEY), FOREIGN KEY (APPLICATION_ID) REFERENCES APPM_APPLICATION(ID) -)ENGINE INNODB; \ No newline at end of file +); \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index d512eafa36f..9ba0df6ddea 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -1,44 +1,227 @@ -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_TYPE ( - ID INTEGER AUTO_INCREMENT, - NAME VARCHAR (255), - DESCRIPTION TEXT, - CODE VARCHAR (255), - PARAMTERS LONGTEXT, - PRIMARY KEY (ID) -)ENGINE INNODB; - -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_CATEGORY ( - ID INTEGER AUTO_INCREMENT, - NAME VARCHAR (255), - DESCRIPTION TEXT, - PRIMARY KEY (ID) -)ENGINE INNODB; - - -CREATE TABLE IF NOT EXISTS APPM_APPLICATION ( - ID INTEGER AUTO_INCREMENT, - NAME VARCHAR (255), - UUID VARCHAR (255), - DESCRIPTION MEDIUMTEXT, - ICON_NAME VARCHAR (255), - BANNER_NAME VARCHAR (255), - VIDEO_NAME VARCHAR (255), - SCREENSHOTS TEXT, - TAGS TEXT, - APPLICATION_TYPE_ID INTEGER, - CATEGORY_ID INTEGER, - CREATED_AT DATETIME, - MODIFIED_AT DATETIME, - PRIMARY KEY (ID), - FOREIGN KEY (CATEGORY_ID) REFERENCES APPM_APPLICATION_CATEGORY(ID), - FOREIGN KEY (APPLICATION_TYPE_ID) REFERENCES APPM_APPLICATION_TYPE(ID) -)ENGINE INNODB; - - -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTIES ( - PROP_KEY VARCHAR (255), - PROP_VAL MEDIUMTEXT, - APPLICATION_ID INTEGER, - PRIMARY KEY (APPLICATION_ID, PROP_KEY), - FOREIGN KEY (APPLICATION_ID) REFERENCES APPM_APPLICATION(ID) -)ENGINE INNODB; \ No newline at end of file +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; + +-- ----------------------------------------------------- +-- Schema WSO2DM_APPM_DB +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_PLATFORM` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_PLATFORM` ( + `ID` INT NOT NULL, + `NAME` VARCHAR(100) NOT NULL, + `DESCRIPTION` TEXT NULL, + `CODE` VARCHAR(100) NOT NULL, + `ICON_NAME` VARCHAR(100) NULL, + `PROPERTIES` LONGTEXT NOT NULL, + `PUBLISHED` TINYINT NULL, + PRIMARY KEY (`ID`)) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application platform'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_CATEGORY` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_CATEGORY` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(100) NOT NULL, + `DESCRIPTION` TEXT NULL, + `TENANT_ID` INT NULL, + `PUBLISHED` TINYINT NULL, + PRIMARY KEY (`ID`)) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application category'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `UUID` VARCHAR(100) NOT NULL, + `NAME` VARCHAR(100) NOT NULL, + `DESCRIPTION` TEXT NULL, + `ICON_NAME` VARCHAR(100) NULL, + `BANNER_NAME` VARCHAR(100) NULL, + `VIDEO_NAME` VARCHAR(100) NULL, + `SCREENSHOTS` TEXT NULL, + `CREATED_AT` DATETIME NULL, + `MODIFIED_AT` DATETIME NULL, + `PUBLISHED` TINYINT NULL, + `APPLICATION_CATEGORY_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`), + UNIQUE INDEX `UUID_UNIQUE` (`UUID` ASC), + INDEX `FK_APPLICATION_APPLICATION_CATEGORY` (`APPLICATION_CATEGORY_ID` ASC), + CONSTRAINT `FK_APPLICATION_APPLICATION_CATEGORY` + FOREIGN KEY (`APPLICATION_CATEGORY_ID`) + REFERENCES `APPM_APPLICATION_CATEGORY` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the applications'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_PROPERTY` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_PROPERTY` ( + `PROP_KEY` VARCHAR(255) NOT NULL, + `PROP_VAL` TEXT NULL, + `APPLICATION_ID` INT NOT NULL, + PRIMARY KEY (`PROP_KEY`, `APPLICATION_ID`), + INDEX `FK_APPLICATION_PROPERTY_APPLICATION` (`APPLICATION_ID` ASC), + CONSTRAINT `FK_APPLICATION_PROPERTY_APPLICATION` + FOREIGN KEY (`APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the properties that related to the application'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_RELEASE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_RELEASE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `VERSION_ID` INT NOT NULL, + `VERSION_NAME` VARCHAR(100) NOT NULL, + `RESOURCE` TEXT NULL, + `RELEASE_CHANNEL` VARCHAR(50) NULL, + `RELEASE_DETAILS` TEXT NULL, + `CREATED_AT` DATETIME NULL, + `APPM_APPLICATION_ID` INT NOT NULL, + `LIFECYCLE_STATE` VARCHAR(50) NULL, + `LIECYCLE_STATE_MODIFIED_BY` VARCHAR(45) NULL, + `LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL, + PRIMARY KEY (`ID`, `APPM_APPLICATION_ID`), + INDEX `FK_APPLICATION_VERSION_APPLICATION` (`APPM_APPLICATION_ID` ASC), + CONSTRAINT `FK_APPLICATION_VERSION_APPLICATION` + FOREIGN KEY (`APPM_APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application releases'; + + +-- ----------------------------------------------------- +-- Table `APPM_RELEASE_PROPERTY` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_RELEASE_PROPERTY` ( + `PROP_KEY` VARCHAR(255) NOT NULL, + `PROP_VALUE` TEXT NULL, + `APPM_APPLICATION_RELEASE_ID` INT NOT NULL, + PRIMARY KEY (`PROP_KEY`, `APPM_APPLICATION_RELEASE_ID`), + INDEX `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` (`APPM_APPLICATION_RELEASE_ID` ASC), + CONSTRAINT `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` + FOREIGN KEY (`APPM_APPLICATION_RELEASE_ID`) + REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the properties that related to the application release'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_SUBSCRIPTION` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_SUBSCRIPTION` ( + `APPLICATION_ID` INT NOT NULL, + `SUBSCRIPTION_TYPE` VARCHAR(50) NOT NULL, + `SUBSCRIPTION_VALUE` VARCHAR(255) NOT NULL, + `CREATED_AT` DATETIME NULL, + PRIMARY KEY (`APPLICATION_ID`, `SUBSCRIPTION_TYPE`, `SUBSCRIPTION_VALUE`), + CONSTRAINT `FK_APPLICATION_INSTALLATION_APPLICATION` + FOREIGN KEY (`APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application subscriptions'; + + +-- ----------------------------------------------------- +-- Table `APPM_COMMENT` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_COMMENT` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `APPM_APPLICATION_RELEASE_ID` INT NOT NULL, + `COMMENT` TEXT NULL, + `RATING` INT NULL, + `PARENT_ID` INT NULL, + `CREATED_AT` DATETIME NULL, + `CREATED_BY` VARCHAR(45) NULL, + `MODIFIED_AT` DATETIME NULL, + `PUBLISHED` TINYINT NULL, + PRIMARY KEY (`ID`, `APPM_APPLICATION_RELEASE_ID`), + INDEX `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` (`APPM_APPLICATION_RELEASE_ID` ASC), + CONSTRAINT `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` + FOREIGN KEY (`APPM_APPLICATION_RELEASE_ID`) + REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application comments'; + + +-- ----------------------------------------------------- +-- Table `APPM_PLATFORM_APPLICATION_MAPPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_APPLICATION_MAPPING` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `APPM_PLATFORM_ID` INT NOT NULL, + `TENANT_ID` INT NULL, + `APPM_APPLICATION_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `APPM_PLATFORM_ID`, `APPM_APPLICATION_ID`), + INDEX `FK_PLATFROM_APPLICATION_MAPPING_PLATFORM` (`APPM_PLATFORM_ID` ASC), + INDEX `FK_PLATFROM_APPLICATION_MAPPING_APPLICATION` (`APPM_APPLICATION_ID` ASC), + CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` + FOREIGN KEY (`APPM_PLATFORM_ID`) + REFERENCES `APPM_APPLICATION_PLATFORM` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_APPLICATION1` + FOREIGN KEY (`APPM_APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related relationship between application platofrm and appication mappings'; + + +-- ----------------------------------------------------- +-- Table `APPM_PLATFORM_TAG` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TAG` ( + `name` VARCHAR(100) NOT NULL, + `APPM_PLATFORM_ID` INT NOT NULL, + PRIMARY KEY (`APPM_PLATFORM_ID`, `name`), + INDEX `fk_PLATFORM_TAGS_PLATFORM` (`APPM_PLATFORM_ID` ASC), + CONSTRAINT `fk_APPM_SUPPORTED_PLATFORM_TAGS_APPM_SUPPORTED_PLATFORM1` + FOREIGN KEY (`APPM_PLATFORM_ID`) + REFERENCES `APPM_APPLICATION_PLATFORM` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the app platform tags'; + + +-- ----------------------------------------------------- +-- Table `APPM_APPLICATION_TAG` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_TAG` ( + `name` VARCHAR(45) NOT NULL, + `APPM_APPLICATION_ID` INT NOT NULL, + PRIMARY KEY (`APPM_APPLICATION_ID`, `name`), + INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPM_APPLICATION_ID` ASC), + CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1` + FOREIGN KEY (`APPM_APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +COMMENT = 'This table contains the data related to the application tags'; \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf index 51c8838ca6f..a51ce36e566 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf @@ -1,3 +1,7 @@ instructions.configure = \ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/conf/datasources/application-mgt-datasources.xml,target:${installFolder}/../../conf/datasources/application-mgt-datasources.xml,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/dbscripts/cdm/application-mgt,target:${installFolder}/../../../dbscripts/cdm/application-mgt,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/dbscripts/cdm/application-mgt,target:${installFolder}/../../../dbscripts/cdm/application-mgt,overwrite:true);\ + +instructions.unconfigure = \ +org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/application-mgt-datasources.xml);\ +org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/application-mgt);\