Updated mysql dbscript

4.x.x
Chatura Dilan 8 years ago
parent 34366f4e78
commit 5e1be78ced

@ -1,23 +1,20 @@
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`
-- Table `APPM_PLATFORM`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_PLATFORM` (
CREATE TABLE IF NOT EXISTS `APPM_PLATFORM` (
`ID` INT NOT NULL,
`NAME` VARCHAR(100) NOT NULL,
`DESCRIPTION` TEXT NULL,
`CODE` VARCHAR(100) NOT NULL,
`IDENTIFIER` VARCHAR(100) NOT NULL,
`ICON_NAME` VARCHAR(100) NULL,
`PROPERTIES` LONGTEXT NOT NULL,
`DESCRIPTOR` LONGTEXT NOT NULL,
`PUBLISHED` TINYINT NULL,
PRIMARY KEY (`ID`))
PRIMARY KEY (`ID`),
UNIQUE INDEX `IDENTIFIER_UNIQUE` (`IDENTIFIER` ASC))
ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application platform';
@ -29,13 +26,30 @@ 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_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_APPLICATION`
-- -----------------------------------------------------
@ -43,22 +57,31 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` (
`ID` INT NOT NULL AUTO_INCREMENT,
`UUID` VARCHAR(100) NOT NULL,
`NAME` VARCHAR(100) NOT NULL,
`SHORT_DESCRIPTION` VARCHAR(255) 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,
`CREATED_BY` VARCHAR(255) NULL,
`CREATED_AT` DATETIME NOT NULL,
`MODIFIED_AT` DATETIME NULL,
`PUBLISHED` TINYINT NULL,
`APPLICATION_CATEGORY_ID` INT NOT NULL,
PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`),
`PLATFORM_APPLICATION_MAPPING_ID` INT NOT NULL,
PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `PLATFORM_APPLICATION_MAPPING_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),
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)
ENGINE = InnoDB
COMMENT = 'This table contains the data related to the applications';
@ -82,6 +105,19 @@ 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_UNIQUE` (`IDENTIFIER` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `APPM_APPLICATION_RELEASE`
-- -----------------------------------------------------
@ -92,17 +128,23 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_RELEASE` (
`RESOURCE` TEXT NULL,
`RELEASE_CHANNEL` VARCHAR(50) NULL,
`RELEASE_DETAILS` TEXT NULL,
`CREATED_AT` DATETIME NULL,
`CREATED_AT` DATETIME NOT NULL,
`APPM_APPLICATION_ID` INT NOT NULL,
`LIFECYCLE_STATE` VARCHAR(50) 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`),
PRIMARY KEY (`ID`, `APPM_APPLICATION_ID`, `APPM_LIFECYCLE_STATE_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`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application releases';
@ -114,11 +156,11 @@ COMMENT = 'This table contains the data related to the application releases';
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),
`APPLICATION_RELEASE_ID` INT NOT NULL,
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 (`APPM_APPLICATION_RELEASE_ID`)
FOREIGN KEY (`APPLICATION_RELEASE_ID`)
REFERENCES `APPM_APPLICATION_RELEASE` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
@ -127,18 +169,44 @@ COMMENT = 'This table contains the data related to the properties that related t
-- -----------------------------------------------------
-- Table `APPM_APPLICATION_SUBSCRIPTION`
-- Table `APPM_RESOURCE_TYPE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_RESOURCE_TYPE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`NAME` VARCHAR(45) NULL,
`DESCRIPTION` TEXT NULL,
PRIMARY KEY (`ID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `APPM_SUBSCRIPTION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_SUBSCRIPTION` (
CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION` (
`ID` INT NOT NULL AUTO_INCREMENT,
`VALUE` VARCHAR(255) NOT NULL,
`CREATED_AT` DATETIME NOT NULL,
`RESOURCE_TYPE_ID` INT NOT NULL,
`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`
`APPLICATION_RELEASE_ID` INT NULL,
PRIMARY KEY (`ID`, `APPLICATION_ID`, `RESOURCE_TYPE_ID`),
INDEX `FK_APPLICATION_SUBSCRIPTION_RESOURCE_TYPE` (`RESOURCE_TYPE_ID` ASC),
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`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_APPM_APPLICATION_SUBSCRIPTION_APPM_APPLICATION1`
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`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application subscriptions';
@ -149,18 +217,19 @@ COMMENT = 'This table contains the data related to the application subscriptions
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_COMMENT` (
`ID` INT NOT NULL AUTO_INCREMENT,
`APPM_APPLICATION_RELEASE_ID` INT NOT NULL,
`COMMENT` TEXT NULL,
`APPLICATION_RELEASE_ID` INT NOT NULL,
`COMMENT_SUBJECT` VARCHAR(255) NULL,
`COMMENT_BODY` TEXT NULL,
`RATING` INT NULL,
`PARENT_ID` INT NULL,
`CREATED_AT` DATETIME NULL,
`CREATED_AT` DATETIME NOT 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),
PRIMARY KEY (`ID`, `APPLICATION_RELEASE_ID`),
INDEX `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC),
CONSTRAINT `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE`
FOREIGN KEY (`APPM_APPLICATION_RELEASE_ID`)
FOREIGN KEY (`APPLICATION_RELEASE_ID`)
REFERENCES `APPM_APPLICATION_RELEASE` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
@ -168,46 +237,21 @@ 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),
`PLATFORM_ID` INT NOT NULL,
PRIMARY KEY (`PLATFORM_ID`, `name`),
INDEX `FK_PLATFORM_TAGS_PLATFORM` (`PLATFORM_ID` ASC),
CONSTRAINT `fk_APPM_SUPPORTED_PLATFORM_TAGS_APPM_SUPPORTED_PLATFORM1`
FOREIGN KEY (`APPM_PLATFORM_ID`)
REFERENCES `APPM_APPLICATION_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 tags';
COMMENT = 'This table contains the data related to the app platform tag';
-- -----------------------------------------------------
@ -215,13 +259,61 @@ COMMENT = 'This table contains the data related to the app platform tags';
-- -----------------------------------------------------
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),
`APPLICATION_ID` INT NOT NULL,
PRIMARY KEY (`APPLICATION_ID`, `name`),
INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPLICATION_ID` ASC),
CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1`
FOREIGN KEY (`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';
-- -----------------------------------------------------
-- Table `APPM_VISIBILITY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_VISIBILITY` (
`ID` INT NOT NULL AUTO_INCREMENT,
`VALUE` VARCHAR(255) NOT NULL,
`RESOURCE_TYPE_ID` INT NOT NULL,
`APPLICATION_RELEASE_ID` INT NULL,
`APPLICATION_ID` INT NULL,
PRIMARY KEY (`ID`, `RESOURCE_TYPE_ID`),
INDEX `FK_APPM_VISIBILITY_RESOURCE_TYPE` (`RESOURCE_TYPE_ID` ASC),
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`)
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`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_APPM_VISIBILITY_APPM_APPLICATION1`
FOREIGN KEY (`APPLICATION_ID`)
REFERENCES `APPM_APPLICATION` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `APPM_SUBSCRIPTION_PROPERTIES`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION_PROPERTIES` (
`PROP_KEY` TEXT NOT NULL,
`PROP_VALUE` TEXT NULL,
`APPM_SUBSCRIPTION_ID` INT NOT NULL,
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`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
Loading…
Cancel
Save