Fix SQL issues

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent e5fb01f23e
commit f0633fb2e4

@ -1,10 +1,7 @@
CREATE SCHEMA IF NOT EXISTS APP_MANAGER
SET CATALOG APP_MANAGER
-- -----------------------------------------------------
-- Table AP_APP
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP(
CREATE TABLE IF NOT EXISTS AP_APP(
ID int NOT NULL AUTO_INCREMENT,
NAME varchar(45) NOT NULL,
DESCRIPTION clob NULL,
@ -15,20 +12,13 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP(
CURRENCY varchar(45) NULL DEFAULT '$',
RATING int NULL,
DEVICE_TYPE_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_DM_DEVICE_TYPE1
FOREIGN KEY (DEVICE_TYPE_ID)
REFERENCES APP_MANAGER.DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_DM_DEVICE_TYPE1_idx (DEVICE_TYPE_ID ASC)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_APP_RELEASE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_RELEASE(
CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
ID int NOT NULL AUTO_INCREMENT,
DESCRIPTION clob NOT NULL,
VERSION varchar(10) NOT NULL,
@ -54,16 +44,14 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_RELEASE(
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_RELEASE_AP_APP1_idx (AP_APP_ID ASC)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
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);
-- -----------------------------------------------------
-- Table AP_APP_REVIEW
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_REVIEW(
CREATE TABLE IF NOT EXISTS AP_APP_REVIEW(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
COMMENT varchar(250) NOT NULL,
@ -80,22 +68,17 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_REVIEW(
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) 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, AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_APP_LIFECYCLE_STATE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_LIFECYCLE_STATE(
CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE(
ID int NOT NULL AUTO_INCREMENT,
CURRENT_STATE varchar(45) NOT NULL,
PREVIOUSE_STATE varchar(45) NOT NULL,
@ -114,35 +97,27 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_LIFECYCLE_STATE(
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_APP_TAG
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_TAG(
CREATE TABLE IF NOT EXISTS AP_APP_TAG(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
TAG varchar(45) NOT NULL,
PRIMARY KEY (ID)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
);
-- -----------------------------------------------------
-- Table AP_DEVICE_SUBSCRIPTION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_DEVICE_SUBSCRIPTION(
CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
SUBSCRIBED_BY varchar(100) NOT NULL,
@ -155,32 +130,23 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_DEVICE_SUBSCRIPTION(
AP_APP_RELEASE_ID int NOT NULL,
AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1
FOREIGN KEY (DM_DEVICE_ID)
REFERENCES APP_MANAGER.DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1_idx (DM_DEVICE_ID ASC),
INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1_idx ON AP_DEVICE_SUBSCRIPTION (DM_DEVICE_ID ASC);
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_GROUP_SUBSCRIPTION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_GROUP_SUBSCRIPTION(
CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
SUBSCRIBED_BY varchar(100) NOT NULL,
@ -192,32 +158,23 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_GROUP_SUBSCRIPTION(
AP_APP_RELEASE_ID int NOT NULL,
AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1
FOREIGN KEY (DM_GROUP_ID)
REFERENCES APP_MANAGER.DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1_idx (DM_GROUP_ID ASC),
INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE INDEX fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1_idx ON AP_GROUP_SUBSCRIPTION (DM_GROUP_ID ASC);
CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC,AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_ROLE_SUBSCRIPTION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_ROLE_SUBSCRIPTION(
CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
ROLE_NAME varchar(100) NOT NULL,
@ -234,23 +191,17 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_ROLE_SUBSCRIPTION(
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) 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, AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_UNRESTRICTED_ROLE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_UNRESTRICTED_ROLE(
CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
ROLE varchar(45) NOT NULL,
@ -258,17 +209,14 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_UNRESTRICTED_ROLE(
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx (AP_APP_ID ASC)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
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);
-- -----------------------------------------------------
-- Table AP_USER_SUBSCRIPTION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_USER_SUBSCRIPTION(
CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
USER_NAME varchar(100) NOT NULL,
@ -285,71 +233,56 @@ CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_USER_SUBSCRIPTION(
AP_APP_RELEASE_ID,
AP_APP_ID
)
REFERENCES APP_MANAGER.AP_APP_RELEASE (
REFERENCES AP_APP_RELEASE (
ID,
AP_APP_ID
) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx (
AP_APP_RELEASE_ID ASC,
AP_APP_ID ASC
)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
) 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, AP_APP_ID ASC);
-- -----------------------------------------------------
-- Table AP_APP_CATEGORY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_CATEGORY(
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
CATEGORY varchar(45) NOT NULL,
CATEGORY_ICON varchar(45) NULL,
PRIMARY KEY (ID)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
);
-- -----------------------------------------------------
-- Table AP_APP_TAG_MAPPING
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_TAG_MAPPING(
CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
AP_APP_TAG_ID int NOT NULL,
AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1
FOREIGN KEY (AP_APP_TAG_ID)
REFERENCES APP_MANAGER.AP_APP_TAG (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
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 APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx (AP_APP_TAG_ID ASC),
INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx (AP_APP_ID ASC)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
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);
-- -----------------------------------------------------
-- Table AP_APP_CATEGORY_MAPPING
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_CATEGORY_MAPPING(
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING(
ID int NOT NULL AUTO_INCREMENT,
TENANT_ID varchar(45) NOT NULL,
AP_APP_CATEGORY_ID int NOT NULL,
AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1
FOREIGN KEY (AP_APP_CATEGORY_ID)
REFERENCES APP_MANAGER.AP_APP_CATEGORY (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
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 APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx (AP_APP_CATEGORY_ID ASC),
INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx (AP_APP_ID ASC)
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
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);

@ -5,19 +5,9 @@ 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 APP_MANAGER
-- Table `AP_APP`
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema APP_MANAGER
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `APP_MANAGER` DEFAULT CHARACTER SET utf8 ;
USE `APP_MANAGER` ;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP` (
CREATE TABLE IF NOT EXISTS `AP_APP` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`NAME` VARCHAR(45) NOT NULL,
`DESCRIPTION` TEXT NULL,
@ -28,21 +18,15 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP` (
`CURRENCY` VARCHAR(45) NULL DEFAULT '$',
`RATING` INT(11) NULL,
`DEVICE_TYPE_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
INDEX `fk_AP_APP_DM_DEVICE_TYPE1_idx` (`DEVICE_TYPE_ID` ASC),
CONSTRAINT `fk_AP_APP_DM_DEVICE_TYPE1`
FOREIGN KEY (`DEVICE_TYPE_ID`)
REFERENCES `APP_MANAGER`.`DM_DEVICE_TYPE` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
PRIMARY KEY (`ID`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_RELEASE`
-- Table `AP_APP_RELEASE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE` (
CREATE TABLE IF NOT EXISTS `AP_APP_RELEASE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`DESCRIPTION` TEXT NOT NULL,
`VERSION` VARCHAR(10) NOT NULL,
@ -69,7 +53,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE` (
INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1`
FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
REFERENCES `AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -78,9 +62,9 @@ COMMENT = '
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_REVIEW`
-- Table `AP_APP_REVIEW`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW` (
CREATE TABLE IF NOT EXISTS `AP_APP_REVIEW` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`COMMENT` VARCHAR(250) NOT NULL,
@ -95,7 +79,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW` (
INDEX `fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_COMMENT_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -103,9 +87,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
-- Table `AP_APP_LIFECYCLE_STATE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` (
CREATE TABLE IF NOT EXISTS `AP_APP_LIFECYCLE_STATE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`CURRENT_STATE` VARCHAR(45) NOT NULL,
`PREVIOUSE_STATE` VARCHAR(45) NOT NULL,
@ -118,7 +102,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` (
INDEX `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -126,9 +110,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_TAG`
-- Table `AP_APP_TAG`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG` (
CREATE TABLE IF NOT EXISTS `AP_APP_TAG` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`TAG` VARCHAR(45) NOT NULL,
@ -138,9 +122,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
-- Table `AP_DEVICE_SUBSCRIPTION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` (
CREATE TABLE IF NOT EXISTS `AP_DEVICE_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
@ -155,23 +139,18 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` (
PRIMARY KEY (`ID`),
INDEX `fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1_idx` (`DM_DEVICE_ID` ASC),
INDEX `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1`
FOREIGN KEY (`DM_DEVICE_ID`)
REFERENCES `APP_MANAGER`.`DM_DEVICE` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
-- Table `AP_GROUP_SUBSCRIPTION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` (
CREATE TABLE IF NOT EXISTS `AP_GROUP_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
@ -185,14 +164,9 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` (
PRIMARY KEY (`ID`),
INDEX `fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1_idx` (`DM_GROUP_ID` ASC),
INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1`
FOREIGN KEY (`DM_GROUP_ID`)
REFERENCES `APP_MANAGER`.`DM_GROUP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -202,7 +176,7 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` (
CREATE TABLE IF NOT EXISTS `AP_ROLE_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`ROLE_NAME` VARCHAR(100) NOT NULL,
@ -217,7 +191,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` (
INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -225,9 +199,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
-- Table `AP_UNRESTRICTED_ROLE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` (
CREATE TABLE IF NOT EXISTS `AP_UNRESTRICTED_ROLE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`ROLE` VARCHAR(45) NOT NULL,
@ -236,7 +210,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` (
INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_VISIBILITY_AP_APP1`
FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
REFERENCES `AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -244,9 +218,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
-- Table `AP_USER_SUBSCRIPTION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION` (
CREATE TABLE IF NOT EXISTS `AP_USER_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`USER_NAME` VARCHAR(100) NOT NULL,
@ -261,7 +235,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION` (
INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -269,9 +243,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_CATEGORY`
-- Table `AP_APP_CATEGORY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY` (
CREATE TABLE IF NOT EXISTS `AP_APP_CATEGORY` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`CATEGORY` VARCHAR(45) NOT NULL,
@ -282,9 +256,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_TAG_MAPPING`
-- Table `AP_APP_TAG_MAPPING`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` (
CREATE TABLE IF NOT EXISTS `AP_APP_TAG_MAPPING` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`AP_APP_TAG_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
@ -293,12 +267,12 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` (
INDEX `fk_AP_APP_TAG_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_TAG_copy1_AP_APP_TAG1`
FOREIGN KEY (`AP_APP_TAG_ID`)
REFERENCES `APP_MANAGER`.`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 `APP_MANAGER`.`AP_APP` (`ID`)
REFERENCES `AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
@ -306,9 +280,9 @@ DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
-- Table `AP_APP_CATEGORY_MAPPING`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` (
CREATE TABLE IF NOT EXISTS `AP_APP_CATEGORY_MAPPING` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`AP_APP_CATEGORY_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
@ -317,12 +291,12 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` (
INDEX `fk_AP_APP_CATEGORY_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1`
FOREIGN KEY (`AP_APP_CATEGORY_ID`)
REFERENCES `APP_MANAGER`.`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 `APP_MANAGER`.`AP_APP` (`ID`)
REFERENCES `AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB

Loading…
Cancel
Save