Fix Application Creating Issue

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 74e4b2ca5d
commit 2f0f47fe92

@ -43,6 +43,7 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringJoiner;
/** /**
* This handles ApplicationDAO related operations. * This handles ApplicationDAO related operations.
@ -911,34 +912,59 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get tag ids for given tag names"); log.debug("Request received in DAO Layer to get tag ids for given tag names");
} }
Connection conn; // Connection conn;
PreparedStatement stmt = null; // PreparedStatement stmt = null;
ResultSet rs = null; // ResultSet rs = null;
try { try {
Connection conn = this.getDBConnection();
int index = 1;
List<Integer> tagIds = new ArrayList<>(); List<Integer> tagIds = new ArrayList<>();
String sql = "SELECT " // String sql = "SELECT "
+ "AP_APP_TAG.ID AS ID " // + "AP_APP_TAG.ID AS ID "
+ "FROM AP_APP_TAG " // + "FROM AP_APP_TAG "
+ "WHERE AP_APP_TAG..NAME IN ( ? ) AND TENANT_ID = ?"; // + "WHERE AP_APP_TAG..NAME IN ( ? ) AND TENANT_ID = ?";
conn = this.getDBConnection(); // conn = this.getDBConnection();
Array array = conn.createArrayOf("VARCHAR", new List[] { tagNames });
stmt = conn.prepareStatement(sql); //
stmt.setArray(1, array); StringJoiner joiner = new StringJoiner(",", "SELECT AP_APP_TAG.ID AS ID FROM AP_APP_TAG "
stmt.setInt(2, tenantId); + "WHERE AP_APP_TAG.TAG IN (", ") AND TENANT_ID = ?");
rs = stmt.executeQuery(); tagNames.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString();
try (PreparedStatement ps = conn.prepareStatement(query)) {
// for (int c = 0; c < tagNames.size(); c++) {
// ps.setObject(c + 1, tagNames.get(c));
// }
for (String tagName : tagNames) {
ps.setObject(index++, tagName);
}
ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) {
while(rs.next()){ while(rs.next()){
tagIds.add(rs.getInt("ID")); tagIds.add(rs.getInt("ID"));
} }
}
}
//
// Array array = conn.createArrayOf("VARCHAR", new List[] { tagNames });
//
// stmt = conn.prepareStatement(sql);
// stmt.setArray(1, array);
// stmt.setInt(2, tenantId);
// rs = stmt.executeQuery();
// while(rs.next()){
// tagIds.add(rs.getInt("ID"));
// }
return tagIds; return tagIds;
} catch (DBConnectionException e) { }
catch (DBConnectionException e) {
throw new ApplicationManagementDAOException( throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding tags", e); "Error occurred while obtaining the DB connection when adding tags", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding tags", e); throw new ApplicationManagementDAOException("Error occurred while adding tags", e);
} finally {
Util.cleanupResources(stmt, rs);
} }
// finally {
// Util.cleanupResources(stmt, rs);
// }
} }
public void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException { public void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException {

@ -160,9 +160,15 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
conn = this.getDBConnection(); conn = this.getDBConnection();
String sql = "INSERT INTO AP_APP_LIFECYCLE_STATE (CURRENT_STATE, PREVIOUS_STATE, TENANT_ID, UPDATED_BY, " String sql = "INSERT INTO AP_APP_LIFECYCLE_STATE "
+ "UPDATED_AT, AP_APP_RELEASE_ID, AP_APP_ID) VALUES (?,?, ?, ?, ?, " + "(CURRENT_STATE, "
+ "(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?),?);"; + "PREVIOUS_STATE, "
+ "TENANT_ID, "
+ "UPDATED_BY, "
+ "UPDATED_AT, "
+ "AP_APP_RELEASE_ID, "
+ "AP_APP_ID) "
+ "VALUES (?,?, ?, ?, ?, (SELECT ID FROM AP_APP_RELEASE WHERE UUID=?),?);";
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Timestamp timestamp = new Timestamp(calendar.getTime().getTime()); Timestamp timestamp = new Timestamp(calendar.getTime().getTime());

@ -294,6 +294,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.debug("Creating a new release. App Id:" + appId); log.debug("Creating a new release. App Id:" + appId);
} }
applicationReleaseEntity = applicationEntity.getApplicationReleases().get(0); applicationReleaseEntity = applicationEntity.getApplicationReleases().get(0);
applicationReleaseEntity.setCurrentState(AppLifecycleState.CREATED.toString());
applicationReleaseEntity = this.applicationReleaseDAO.createRelease(applicationReleaseEntity, appId, tenantId); applicationReleaseEntity = this.applicationReleaseDAO.createRelease(applicationReleaseEntity, appId, tenantId);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS AP_APP(
NAME VARCHAR(45) NOT NULL, NAME VARCHAR(45) NOT NULL,
DESCRIPTION CLOB NULL, DESCRIPTION CLOB NULL,
TYPE VARCHAR(200) NOT NULL, TYPE VARCHAR(200) NOT NULL,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE', STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
SUB_TYPE VARCHAR(45) NOT NULL, SUB_TYPE VARCHAR(45) NOT NULL,
CURRENCY VARCHAR(45) NULL DEFAULT '$', CURRENCY VARCHAR(45) NULL DEFAULT '$',
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
DESCRIPTION CLOB NOT NULL, DESCRIPTION CLOB NOT NULL,
VERSION VARCHAR(10) NOT NULL, VERSION VARCHAR(10) NOT NULL,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
UUID VARCHAR(200) NOT NULL, UUID VARCHAR(200) NOT NULL,
RELEASE_TYPE VARCHAR(45) NOT NULL, RELEASE_TYPE VARCHAR(45) NOT NULL,
PACKAGE_NAME VARCHAR(45) NOT NULL, PACKAGE_NAME VARCHAR(45) NOT NULL,
@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
CURRENT_STATE VARCHAR(45) NOT NULL, CURRENT_STATE VARCHAR(45) NOT NULL,
RATED_USERS INTEGER NULL, RATED_USERS INTEGER NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID, AP_APP_ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1 CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
FOREIGN KEY (AP_APP_ID) FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
@ -53,7 +53,7 @@ CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_REVIEW( CREATE TABLE IF NOT EXISTS AP_APP_REVIEW(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
COMMENT VARCHAR(250) NOT NULL, COMMENT VARCHAR(250) NOT NULL,
REPLY_COMMENT VARCHAR(250) NULL, REPLY_COMMENT VARCHAR(250) NULL,
CREATED_AT TIMESTAMP NOT NULL, CREATED_AT TIMESTAMP NOT NULL,
@ -61,13 +61,12 @@ CREATE TABLE IF NOT EXISTS AP_APP_REVIEW(
RATING INTEGER NULL, RATING INTEGER NULL,
USERNAME VARCHAR(45) NOT NULL, USERNAME VARCHAR(45) NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1 CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) 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); CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_APP_LIFECYCLE_STATE -- Table AP_APP_LIFECYCLE_STATE
@ -75,27 +74,27 @@ CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELE
CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE( CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
CURRENT_STATE VARCHAR(45) NOT NULL, CURRENT_STATE VARCHAR(45) NOT NULL,
PREVIOUSE_STATE VARCHAR(45) NOT NULL, PREVIOUS_STATE VARCHAR(45) NOT NULL,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
UPDATED_BY VARCHAR(100) NOT NULL, UPDATED_BY VARCHAR(100) NOT NULL,
UPDATED_AT TIMESTAMP NOT NULL, UPDATED_AT TIMESTAMP NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
REASON VARCHAR(45) NULL, REASON VARCHAR(45) NULL,
PRIMARY KEY (ID, AP_APP_RELEASE_ID, AP_APP_ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1 CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) 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); CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_APP_TAG -- Table AP_APP_TAG
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_TAG( CREATE TABLE IF NOT EXISTS AP_APP_TAG(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
TAG VARCHAR(45) NOT NULL, TAG VARCHAR(100) NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );
@ -104,11 +103,11 @@ CREATE TABLE IF NOT EXISTS AP_APP_TAG(
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION( CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED INTEGER NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
UNSUBSCRIBED_BY INTEGER NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
SUBSCRIBED_FROM VARCHAR(45) NULL, SUBSCRIBED_FROM VARCHAR(45) NULL,
DM_DEVICE_ID INTEGER NOT NULL, DM_DEVICE_ID INTEGER NOT NULL,
@ -116,59 +115,59 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1 CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_GROUP_SUBSCRIPTION -- Table AP_GROUP_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION( CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED INTEGER NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
UNSUBSCRIBED_BY INTEGER NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
DM_GROUP_ID INTEGER NOT NULL, DM_GROUP_ID INTEGER NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1 CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC,AP_APP_ID ASC); CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_ROLE_SUBSCRIPTION -- Table AP_ROLE_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION( CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
ROLE_NAME VARCHAR(100) NOT NULL, ROLE_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED INTEGER NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
UNSUBSCRIBED_BY INTEGER NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1 CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) 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); CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_UNRESTRICTED_ROLE -- Table AP_UNRESTRICTED_ROLE
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE( CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
ROLE VARCHAR(45) NOT NULL, ROLE VARCHAR(45) NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
@ -183,28 +182,28 @@ CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION( CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL, USER_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED INTEGER NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
UNSUBSCRIBED_BY INTEGER NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1 CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID, AP_APP_ID) FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID, AP_APP_ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP_RELEASE (ID) 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); CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table AP_APP_CATEGORY -- Table AP_APP_CATEGORY
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY( CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL,
CATEGORY VARCHAR(45) NOT NULL, CATEGORY VARCHAR(45) NOT NULL,
CATEGORY_ICON VARCHAR(45) NULL, CATEGORY_ICON VARCHAR(45) NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
@ -215,6 +214,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY(
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING( CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
AP_APP_TAG_ID INTEGER NOT NULL, AP_APP_TAG_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
@ -233,6 +233,7 @@ CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID AS
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING( CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING(
ID INTEGER NOT NULL AUTO_INCREMENT, ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
AP_APP_CATEGORY_ID INTEGER NOT NULL, AP_APP_CATEGORY_ID INTEGER NOT NULL,
AP_APP_ID INTEGER NOT NULL, AP_APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),

@ -1,55 +1,20 @@
-- 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 APP_MANAGER
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema APP_MANAGER
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `APP_MANAGER` DEFAULT CHARACTER SET utf8 ;
USE `APP_MANAGER` ;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`DM_DEVICE_TYPE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`DM_DEVICE_TYPE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`NAME` VARCHAR(300) NULL DEFAULT NULL,
`DEVICE_TYPE_META` VARCHAR(20000) NULL DEFAULT NULL,
`LAST_UPDATED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`PROVIDER_TENANT_ID` INT(11) NULL DEFAULT '0',
`SHARED_WITH_ALL_TENANTS` TINYINT(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP` -- Table `APP_MANAGER`.`AP_APP`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`ID` INT(11) NOT NULL,
`NAME` VARCHAR(45) NOT NULL, `NAME` VARCHAR(45) NOT NULL,
`DESCRIPTION` TEXT NULL, `DESCRIPTION` TEXT NULL,
`TYPE` VARCHAR(200) NOT NULL, `TYPE` VARCHAR(200) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL, `TENANT_ID` INT(11) NOT NULL,
`STATUS` VARCHAR(45) NOT NULL DEFAULT 'ACTIVE ', `STATUS` VARCHAR(45) NOT NULL DEFAULT 'ACTIVE ',
`SUB_TYPE` VARCHAR(45) NOT NULL, `SUB_TYPE` VARCHAR(45) NOT NULL,
`CURRENCY` VARCHAR(45) NULL DEFAULT '$', `CURRENCY` VARCHAR(45) NULL DEFAULT '$',
`RATING` INT(11) NULL, `RATING` INT(11) NULL,
`DEVICE_TYPE_ID` INT(11) NOT NULL, `DEVICE_TYPE_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), 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)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -57,11 +22,12 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_RELEASE` -- Table `APP_MANAGER`.`AP_APP_RELEASE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`ID` INT(11) NOT NULL,
`DESCRIPTION` TEXT NOT NULL, `DESCRIPTION` TEXT NOT NULL,
`VERSION` VARCHAR(10) NOT NULL, `VERSION` VARCHAR(10) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL, `TENANT_ID` INT(11) NOT NULL,
`UUID` VARCHAR(200) NOT NULL, `UUID` VARCHAR(200) NOT NULL,
`RELEASE_TYPE` VARCHAR(45) NOT NULL, `RELEASE_TYPE` VARCHAR(45) NOT NULL,
`APP_PRICE` DECIMAL(6, 2) NULL DEFAULT NULL, `APP_PRICE` DECIMAL(6, 2) NULL DEFAULT NULL,
@ -79,39 +45,40 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE` (
`CURRENT_STATE` VARCHAR(45) NULL, `CURRENT_STATE` VARCHAR(45) NULL,
`RATED_USERS` INT(11) NULL, `RATED_USERS` INT(11) NULL,
`AP_APP_ID` INT(11) NOT NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`, `AP_APP_ID`), PRIMARY KEY (`ID`),
INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` (`AP_APP_ID` ASC), INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1` CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1`
FOREIGN KEY (`AP_APP_ID`) FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`) REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8 DEFAULT CHARACTER SET = utf8;
COMMENT = ' ';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_REVIEW` -- Table `APP_MANAGER`.`AP_APP_REVIEW`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`COMMENT` VARCHAR(250) NOT NULL, `COMMENT` VARCHAR(250) NOT NULL,
`REPLY_COMMENT` VARCHAR(250) NULL, `REPLY_COMMENT` VARCHAR(250) NULL,
`CREATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `CREATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFIED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `MODIFIED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`RATING` INT(11) NULL, `RATING` INT(11) NOT NULL,
`USERNAME` VARCHAR(45) NOT NULL, `USERNAME` VARCHAR(45) NOT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
INDEX `fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC), INDEX `fk_AP_APP_REVIEW_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
CONSTRAINT `fk_AP_APP_COMMENT_AP_APP_RELEASE1` CONSTRAINT `fk_AP_APP_REVIEW_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -119,23 +86,24 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` -- Table `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`ID` INT(11) NOT NULL,
`CURRENT_STATE` VARCHAR(45) NOT NULL, `CURRENT_STATE` VARCHAR(45) NOT NULL,
`PREVIOUSE_STATE` VARCHAR(45) NOT NULL, `PREVIOUS_STATE` VARCHAR(45) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL, `TENANT_ID` INT(11) NOT NULL,
`UPDATED_BY` VARCHAR(100) NOT NULL, `UPDATED_BY` VARCHAR(100) NOT NULL,
`UPDATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `UPDATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`REASON` VARCHAR(45) NULL, `REASON` VARCHAR(45) NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL, PRIMARY KEY (`ID`),
PRIMARY KEY (`ID`, `AP_APP_RELEASE_ID`, `AP_APP_ID`), INDEX `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
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` CONSTRAINT `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -143,34 +111,13 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_TAG` -- Table `APP_MANAGER`.`AP_APP_TAG`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TAG` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL, `TAG` VARCHAR(100) NOT NULL,
PRIMARY KEY (`ID`)) `TENANT_ID` INT(11) NOT NULL,
ENGINE = InnoDB PRIMARY KEY (`ID`)
DEFAULT CHARACTER SET = utf8; )
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`DM_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`DM_DEVICE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`DESCRIPTION` TEXT NULL DEFAULT NULL,
`NAME` VARCHAR(100) NULL DEFAULT NULL,
`DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL,
`DEVICE_IDENTIFICATION` VARCHAR(250) NULL DEFAULT NULL,
`LAST_UPDATED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`TENANT_ID` INT(11) NULL DEFAULT '0',
PRIMARY KEY (`ID`),
UNIQUE INDEX `uk_DM_DEVICE` (`DEVICE_TYPE_ID` ASC, `DEVICE_IDENTIFICATION` ASC, `TENANT_ID` ASC),
INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2` (`DEVICE_TYPE_ID` ASC),
CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2`
FOREIGN KEY (`DEVICE_TYPE_ID`)
REFERENCES `APP_MANAGER`.`DM_DEVICE_TYPE` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -178,45 +125,26 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`DM_DEVICE` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` -- Table `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UNSUBSCRIBED` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
`UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL, `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`SUBSCRIBED_FROM` VARCHAR(45) NULL, `SUBSCRIBED_FROM` VARCHAR(45) NULL,
`DM_DEVICE_ID` INT(11) NOT NULL, `DM_DEVICE_ID` INT(11) NOT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), 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),
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` CONSTRAINT `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
ENGINE = InnoDB )
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `APP_MANAGER`.`DM_GROUP`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`DM_GROUP` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`GROUP_NAME` VARCHAR(100) NULL DEFAULT NULL,
`DESCRIPTION` TEXT NULL DEFAULT NULL,
`OWNER` VARCHAR(45) NULL DEFAULT NULL,
`TENANT_ID` INT(11) NULL DEFAULT '0',
PRIMARY KEY (`ID`))
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -224,30 +152,25 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`DM_GROUP` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` -- Table `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UNSUBSCRIBED` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
`UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL, `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`DM_GROUP_ID` INT(11) NOT NULL, `DM_GROUP_ID` INT(11) NOT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL, INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
PRIMARY KEY (`ID`), 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` CONSTRAINT `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -255,24 +178,25 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` -- Table `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`ROLE_NAME` VARCHAR(100) NOT NULL, `ROLE_NAME` VARCHAR(100) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UNSUBSCRIBED` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
`UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL, `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC), INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1` CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -280,10 +204,11 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` -- Table `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`ROLE` VARCHAR(45) NOT NULL, `TENANT_ID` INT(11) NOT NULL,
`ROLE` VARCHAR(100) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` (`AP_APP_ID` ASC), INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` (`AP_APP_ID` ASC),
@ -291,7 +216,8 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` (
FOREIGN KEY (`AP_APP_ID`) FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`) REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -299,24 +225,25 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_USER_SUBSCRIPTION` -- Table `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`USER_NAME` VARCHAR(100) NOT NULL, `USER_NAME` VARCHAR(100) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UNSUBSCRIBED` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
`UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL, `UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL, `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC), INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1` CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`) FOREIGN KEY (`AP_APP_RELEASE_ID`)
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`) REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -324,12 +251,14 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_CATEGORY` -- Table `APP_MANAGER`.`AP_APP_CATEGORY`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`ID` INT(11) NOT NULL,
`CATEGORY` VARCHAR(45) NOT NULL, `CATEGORY` VARCHAR(45) NOT NULL,
`CATEGORY_ICON` VARCHAR(45) NULL, `CATEGORY_ICON` VARCHAR(45) NULL,
`TENANT_ID` VARCHAR(45) NULL, `TENANT_ID` INT(11) NULL,
PRIMARY KEY (`ID`)) PRIMARY KEY (`ID`)
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -337,9 +266,10 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_TAG_MAPPING` -- Table `APP_MANAGER`.`AP_APP_TAG_MAPPING`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`AP_APP_TAG_ID` INT(11) NOT NULL, `AP_APP_TAG_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
@ -354,7 +284,8 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` (
FOREIGN KEY (`AP_APP_ID`) FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`) REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
@ -362,9 +293,10 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` -- Table `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` ( CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
`ID` INT(11) NOT NULL AUTO_INCREMENT, (
`TENANT_ID` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL,
`TENANT_ID` INT(11) NOT NULL,
`AP_APP_CATEGORY_ID` INT(11) NOT NULL, `AP_APP_CATEGORY_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
@ -379,11 +311,7 @@ CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` (
FOREIGN KEY (`AP_APP_ID`) FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`) REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION
)
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8; DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Loading…
Cancel
Save