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 6799cc928b0..485fb3b2bf2 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,3 +1,12 @@ +-- MySQL Script generated by MySQL Workbench +-- 2017-06-14 12:46:43 +0530 +-- Model: New Model Version: 1.0 +-- MySQL Workbench Forward Engineering + +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 -- ----------------------------------------------------- @@ -10,9 +19,7 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM` ( `NAME` VARCHAR(100) NOT NULL, `DESCRIPTION` TEXT NULL, `IDENTIFIER` VARCHAR(100) NOT NULL, - `ICON_NAME` VARCHAR(100) NULL, `DESCRIPTOR` LONGTEXT NOT NULL, - `PUBLISHED` TINYINT(1) NULL, PRIMARY KEY (`ID`), UNIQUE INDEX `IDENTIFIER_UNIQUE` (`IDENTIFIER` ASC)) ENGINE = InnoDB @@ -32,24 +39,6 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_CATEGORY` ( COMMENT = 'This table contains the data related to the application category'; --- ----------------------------------------------------- --- Table `APPM_PLATFORM_APPLICATION_MAPPING` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_APPLICATION_MAPPING` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `PLATFORM_ID` INT NOT NULL, - `TENANT_ID` INT NOT NULL, - 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`) - 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_LIFECYCLE_STATE` -- ----------------------------------------------------- @@ -84,28 +73,29 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` ( `PAYMENT_CURRENCY` VARCHAR(45) NULL, `PAYMENT_PRICE` DECIMAL(10,2) NULL, `APPLICATION_CATEGORY_ID` INT NOT NULL, - `PLATFORM_APPLICATION_MAPPING_ID` INT NOT NULL, - `APPM_LIFECYCLE_STATE_ID` INT NOT NULL, - `LIECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL, + `LIFECYCLE_STATE_ID` INT NOT NULL, + `LIFECYCLE_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`), + `TENANT_ID` INT NULL, + `PLATFORM_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `LIFECYCLE_STATE_ID`, `PLATFORM_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), + INDEX `FK_APPLICATION_LIFECYCLE_STATE` (`LIFECYCLE_STATE_ID` ASC), + INDEX `FK_APPM_APPLICATION_APPM_PLATFORM` (`PLATFORM_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, - CONSTRAINT `fk_APPM_APPLICATION_APPM_PLATFORM_APPLICATION_MAPPING1` - 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`) + 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) ENGINE = InnoDB @@ -242,6 +232,24 @@ CREATE TABLE IF NOT EXISTS `APPM_COMMENT` ( COMMENT = 'This table contains the data related to the application comments'; +-- ----------------------------------------------------- +-- Table `APPM_PLATFORM_TENENT_MAPPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TENENT_MAPPING` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `PLATFORM_ID` INT NOT NULL, + `TENANT_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `PLATFORM_ID`), + INDEX `FK_PLATFROM_TENANT_MAPPING_PLATFORM` (`PLATFORM_ID` ASC), + CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` + 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'; + + -- ----------------------------------------------------- -- Table `APPM_PLATFORM_TAG` -- ----------------------------------------------------- @@ -263,9 +271,9 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TAG` ( -- Table `APPM_APPLICATION_TAG` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_TAG` ( - `name` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(45) NOT NULL, `APPLICATION_ID` INT NOT NULL, - PRIMARY KEY (`APPLICATION_ID`, `name`), + PRIMARY KEY (`APPLICATION_ID`, `NAME`), INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPLICATION_ID` ASC), CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1` FOREIGN KEY (`APPLICATION_ID`) @@ -321,4 +329,9 @@ CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION_PROPERTIES` ( REFERENCES `APPM_SUBSCRIPTION` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) - ENGINE = InnoDB; \ No newline at end of file + ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;