From fa88673ac42577de5fd4d89ad784ea21b76b1920 Mon Sep 17 00:00:00 2001 From: Chatura Dilan Date: Fri, 19 May 2017 10:22:31 +0530 Subject: [PATCH] Changed lifecycle management to application from release --- .../dbscripts/cdm/application-mgt/mysql.sql | 171 +++++++++--------- 1 file changed, 86 insertions(+), 85 deletions(-) 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 b3eb911c404..5fcf9864e75 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 @@ -12,11 +12,11 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM` ( `IDENTIFIER` VARCHAR(100) NOT NULL, `ICON_NAME` VARCHAR(100) NULL, `DESCRIPTOR` LONGTEXT NOT NULL, - `PUBLISHED` TINYINT NULL, + `PUBLISHED` TINYINT(1) NULL, PRIMARY KEY (`ID`), UNIQUE INDEX `IDENTIFIER_UNIQUE` (`IDENTIFIER` ASC)) -ENGINE = InnoDB -COMMENT = 'This table contains the data related to the application platform'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application platform'; -- ----------------------------------------------------- @@ -26,10 +26,10 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_CATEGORY` ( `ID` INT NOT NULL AUTO_INCREMENT, `NAME` VARCHAR(100) NOT NULL, `DESCRIPTION` TEXT NULL, - `PUBLISHED` TINYINT NULL, + `PUBLISHED` TINYINT(1) NULL, PRIMARY KEY (`ID`)) -ENGINE = InnoDB -COMMENT = 'This table contains the data related to the application category'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application category'; -- ----------------------------------------------------- @@ -42,12 +42,25 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_APPLICATION_MAPPING` ( PRIMARY KEY (`ID`, `PLATFORM_ID`), INDEX `FK_PLATFROM_APPLICATION_MAPPING_PLATFORM` (`PLATFORM_ID` ASC), CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` - FOREIGN KEY (`PLATFORM_ID`) - REFERENCES `APPM_PLATFORM` (`ID`) + FOREIGN KEY (`PLATFORM_ID`) + REFERENCES `APPM_PLATFORM` (`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'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related relationship between application platofrm and appication mappings'; + + +-- ----------------------------------------------------- +-- Table `APPM_LIFECYCLE_STATE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_LIFECYCLE_STATE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(100) NOT NULL, + `IDENTIFIER` VARCHAR(100) NOT NULL, + `DESCRIPTION` TEXT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `IDENTIFIER_UNIQUE` (`IDENTIFIER` ASC)) + ENGINE = InnoDB; -- ----------------------------------------------------- @@ -66,25 +79,33 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` ( `CREATED_BY` VARCHAR(255) NULL, `CREATED_AT` DATETIME NOT NULL, `MODIFIED_AT` DATETIME NULL, - `PUBLISHED` TINYINT NULL, `APPLICATION_CATEGORY_ID` INT NOT NULL, `PLATFORM_APPLICATION_MAPPING_ID` INT NOT NULL, - PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `PLATFORM_APPLICATION_MAPPING_ID`), + `APPM_LIFECYCLE_STATE_ID` INT NOT NULL, + `LIECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL, + `LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL, + PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `PLATFORM_APPLICATION_MAPPING_ID`, `APPM_LIFECYCLE_STATE_ID`), UNIQUE INDEX `UUID_UNIQUE` (`UUID` ASC), INDEX `FK_APPLICATION_APPLICATION_CATEGORY` (`APPLICATION_CATEGORY_ID` ASC), INDEX `FK_APPLICATION_PLATFORM_APPLICATION_MAPPING` (`PLATFORM_APPLICATION_MAPPING_ID` ASC), + INDEX `FK_APPLICATION_LIFECYCLE_STATE` (`APPM_LIFECYCLE_STATE_ID` ASC), CONSTRAINT `FK_APPLICATION_APPLICATION_CATEGORY` - FOREIGN KEY (`APPLICATION_CATEGORY_ID`) - REFERENCES `APPM_APPLICATION_CATEGORY` (`ID`) + FOREIGN KEY (`APPLICATION_CATEGORY_ID`) + REFERENCES `APPM_APPLICATION_CATEGORY` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_APPLICATION_APPM_PLATFORM_APPLICATION_MAPPING1` - FOREIGN KEY (`PLATFORM_APPLICATION_MAPPING_ID`) - REFERENCES `APPM_PLATFORM_APPLICATION_MAPPING` (`ID`) + FOREIGN KEY (`PLATFORM_APPLICATION_MAPPING_ID`) + REFERENCES `APPM_PLATFORM_APPLICATION_MAPPING` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_APPM_APPLICATION_APPM_LIFECYCLE_STATE1` + FOREIGN KEY (`APPM_LIFECYCLE_STATE_ID`) + REFERENCES `APPM_LIFECYCLE_STATE` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) -ENGINE = InnoDB -COMMENT = 'This table contains the data related to the applications'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the applications'; -- ----------------------------------------------------- @@ -97,25 +118,12 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_PROPERTY` ( 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`) + 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_LIFECYCLE_STATE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `APPM_LIFECYCLE_STATE` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `NAME` VARCHAR(100) NOT NULL, - `IDENTIFIER` VARCHAR(100) NOT NULL, - `DESCRIPTION` TEXT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `IDENTIFIER_UNIQUE1` (`IDENTIFIER` ASC)) -ENGINE = InnoDB; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the properties that related to the application'; -- ----------------------------------------------------- @@ -130,24 +138,16 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_RELEASE` ( `RELEASE_DETAILS` TEXT NULL, `CREATED_AT` DATETIME NOT NULL, `APPM_APPLICATION_ID` INT NOT NULL, - `APPM_LIFECYCLE_STATE_ID` INT NOT NULL, - `LIECYCLE_STATE_MODIFIED_BY` VARCHAR(45) NULL, - `LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL, - PRIMARY KEY (`ID`, `APPM_APPLICATION_ID`, `APPM_LIFECYCLE_STATE_ID`), + `PUBLISHED` TINYINT(1) NULL, + PRIMARY KEY (`ID`, `APPM_APPLICATION_ID`), INDEX `FK_APPLICATION_VERSION_APPLICATION` (`APPM_APPLICATION_ID` ASC), - INDEX `FK_APPLICATION_RELEASE_APPM_LIFECYCLE_STATE` (`APPM_LIFECYCLE_STATE_ID` ASC), CONSTRAINT `FK_APPLICATION_VERSION_APPLICATION` - FOREIGN KEY (`APPM_APPLICATION_ID`) - REFERENCES `APPM_APPLICATION` (`ID`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_APPM_APPLICATION_RELEASE_APPM_LIFECYCLE_STATE1` - FOREIGN KEY (`APPM_LIFECYCLE_STATE_ID`) - REFERENCES `APPM_LIFECYCLE_STATE` (`ID`) + 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'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application releases'; -- ----------------------------------------------------- @@ -160,12 +160,12 @@ CREATE TABLE IF NOT EXISTS `APPM_RELEASE_PROPERTY` ( PRIMARY KEY (`PROP_KEY`, `APPLICATION_RELEASE_ID`), INDEX `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), CONSTRAINT `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` - FOREIGN KEY (`APPLICATION_RELEASE_ID`) - REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + FOREIGN KEY (`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'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the properties that related to the application release'; -- ----------------------------------------------------- @@ -176,7 +176,7 @@ CREATE TABLE IF NOT EXISTS `APPM_RESOURCE_TYPE` ( `NAME` VARCHAR(45) NULL, `DESCRIPTION` TEXT NULL, PRIMARY KEY (`ID`)) -ENGINE = InnoDB; + ENGINE = InnoDB; -- ----------------------------------------------------- @@ -194,22 +194,22 @@ CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION` ( INDEX `FK_APPLICATION_SUBSCRIPTION_APPLICATION` (`APPLICATION_ID` ASC), INDEX `FK_APPLICATION_SUBSCRIPTION_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), CONSTRAINT `fk_APPM_APPLICATION_SUBSCRIPTION_APPM_RESOURCE_TYPE1` - FOREIGN KEY (`RESOURCE_TYPE_ID`) - REFERENCES `APPM_RESOURCE_TYPE` (`ID`) + FOREIGN KEY (`RESOURCE_TYPE_ID`) + REFERENCES `APPM_RESOURCE_TYPE` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_APPLICATION_SUBSCRIPTION_APPM_APPLICATION1` - FOREIGN KEY (`APPLICATION_ID`) - REFERENCES `APPM_APPLICATION` (`ID`) + FOREIGN KEY (`APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_APPLICATION_SUBSCRIPTION_APPM_APPLICATION_RELEASE1` - FOREIGN KEY (`APPLICATION_RELEASE_ID`) - REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + FOREIGN KEY (`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 subscriptions'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application subscriptions'; -- ----------------------------------------------------- @@ -225,16 +225,17 @@ CREATE TABLE IF NOT EXISTS `APPM_COMMENT` ( `CREATED_AT` DATETIME NOT NULL, `CREATED_BY` VARCHAR(45) NULL, `MODIFIED_AT` DATETIME NULL, - `PUBLISHED` TINYINT NULL, + `PUBLISHED` TINYINT(1) NULL, + `APPROVED` TINYINT(1) NULL, PRIMARY KEY (`ID`, `APPLICATION_RELEASE_ID`), INDEX `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), CONSTRAINT `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` - FOREIGN KEY (`APPLICATION_RELEASE_ID`) - REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + FOREIGN KEY (`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'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application comments'; -- ----------------------------------------------------- @@ -246,12 +247,12 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TAG` ( PRIMARY KEY (`PLATFORM_ID`, `name`), INDEX `FK_PLATFORM_TAGS_PLATFORM` (`PLATFORM_ID` ASC), CONSTRAINT `fk_APPM_SUPPORTED_PLATFORM_TAGS_APPM_SUPPORTED_PLATFORM1` - FOREIGN KEY (`PLATFORM_ID`) - REFERENCES `APPM_PLATFORM` (`ID`) + FOREIGN KEY (`PLATFORM_ID`) + REFERENCES `APPM_PLATFORM` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) -ENGINE = InnoDB -COMMENT = 'This table contains the data related to the app platform tag'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the app platform tag'; -- ----------------------------------------------------- @@ -263,12 +264,12 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_TAG` ( PRIMARY KEY (`APPLICATION_ID`, `name`), INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPLICATION_ID` ASC), CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1` - FOREIGN KEY (`APPLICATION_ID`) - REFERENCES `APPM_APPLICATION` (`ID`) + 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 tags'; + ENGINE = InnoDB + COMMENT = 'This table contains the data related to the application tags'; -- ----------------------------------------------------- @@ -285,21 +286,21 @@ CREATE TABLE IF NOT EXISTS `APPM_VISIBILITY` ( INDEX `FK_VISIBILITY_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), INDEX `FK_VISIBILITY_APPLICATION` (`APPLICATION_ID` ASC), CONSTRAINT `fk_APPM_VISIBILITY_APPM_RESOURCE_TYPE1` - FOREIGN KEY (`RESOURCE_TYPE_ID`) - REFERENCES `APPM_RESOURCE_TYPE` (`ID`) + FOREIGN KEY (`RESOURCE_TYPE_ID`) + REFERENCES `APPM_RESOURCE_TYPE` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_VISIBILITY_APPM_APPLICATION_RELEASE1` - FOREIGN KEY (`APPLICATION_RELEASE_ID`) - REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) + FOREIGN KEY (`APPLICATION_RELEASE_ID`) + REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_VISIBILITY_APPM_APPLICATION1` - FOREIGN KEY (`APPLICATION_ID`) - REFERENCES `APPM_APPLICATION` (`ID`) + FOREIGN KEY (`APPLICATION_ID`) + REFERENCES `APPM_APPLICATION` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) -ENGINE = InnoDB; + ENGINE = InnoDB; -- ----------------------------------------------------- @@ -312,8 +313,8 @@ CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION_PROPERTIES` ( PRIMARY KEY (`PROP_KEY`, `APPM_SUBSCRIPTION_ID`), INDEX `FK_SUBSCRIPTION_PROPERTIES_SUBSCRIPTION` (`APPM_SUBSCRIPTION_ID` ASC), CONSTRAINT `fk_APPM_SUBSCRIPTION_PROPERTIES_APPM_SUBSCRIPTION1` - FOREIGN KEY (`APPM_SUBSCRIPTION_ID`) - REFERENCES `APPM_SUBSCRIPTION` (`ID`) + FOREIGN KEY (`APPM_SUBSCRIPTION_ID`) + REFERENCES `APPM_SUBSCRIPTION` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) -ENGINE = InnoDB; \ No newline at end of file + ENGINE = InnoDB; \ No newline at end of file