Merge branch 'application-mgt-new' of https://github.com/lasanthaDLPDS/carbon-device-mgt into application-mgt-new

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
commit 421dc5edf1

@ -0,0 +1,75 @@
/*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.core;
import org.junit.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class StorageManagementUtilTest {
private static final String TEMP_FOLDER = "src/test/resources/util/temp";
private static final String APK_FILE = "src/test/resources/util/app-debug.apk";
private static final String APK_FILE_NAME = "/app-debug.apk";
@BeforeMethod
public void before() throws IOException {
File file = new File(TEMP_FOLDER);
if (file.exists()) {
StorageManagementUtil.deleteDir(file);
}
}
@Test
public void testCreateArtifactDirectory() {
try {
StorageManagementUtil.createArtifactDirectory(TEMP_FOLDER);
} catch (ResourceManagementException e) {
e.printStackTrace();
Assert.fail("Directory creation failed.");
}
}
@Test
public void testSaveFile() throws IOException, ResourceManagementException {
StorageManagementUtil.createArtifactDirectory(TEMP_FOLDER);
InputStream apk = new FileInputStream(APK_FILE);
StorageManagementUtil.saveFile(apk, TEMP_FOLDER + APK_FILE_NAME);
File file = new File(TEMP_FOLDER + APK_FILE_NAME);
if (!file.exists()) {
Assert.fail("File saving failed.");
}
}
@AfterMethod
public void deleteFileTest() throws IOException, ResourceManagementException {
File file = new File(TEMP_FOLDER);
StorageManagementUtil.deleteDir(file);
if (file.exists()) {
Assert.fail("File deleting failed.");
}
}
}

@ -23,6 +23,7 @@
<test name="Util classes tests" preserve-order="true"> <test name="Util classes tests" preserve-order="true">
<classes> <classes>
<class name="org.wso2.carbon.device.application.mgt.core.ArtifactParserTest"/> <class name="org.wso2.carbon.device.application.mgt.core.ArtifactParserTest"/>
<class name="org.wso2.carbon.device.application.mgt.core.StorageManagementUtilTest"/>
</classes> </classes>
</test> </test>
</suite> </suite>

@ -73,32 +73,14 @@ import javax.ws.rs.core.Response;
@Scope( @Scope(
name = "Get Application Details", name = "Get Application Details",
description = "Get application details", description = "Get application details",
key = "perm:application:get", key = "perm:app:publisher:view",
permissions = {"/device-mgt/application/get"} permissions = {"/device-mgt/application/view"}
),
@Scope(
name = "Create an Application",
description = "Create an application",
key = "perm:application:create",
permissions = {"/device-mgt/application/create"}
), ),
@Scope( @Scope(
name = "Update an Application", name = "Update an Application",
description = "Update an application", description = "Update an application",
key = "perm:application:update", key = "perm:app:publisher:update",
permissions = {"/device-mgt/application/update"} permissions = {"/device-mgt/application/update"}
),
@Scope(
name = "Login to Application Management",
description = "Login to Application Management",
key = "perm:application-mgt:login",
permissions = {"/device-mgt/application-mgt/login"}
),
@Scope(
name = "Delete an Application",
description = "Delete an application",
key = "perm:application:delete",
permissions = {"/device-mgt/application/delete"}
) )
} }
) )
@ -122,7 +104,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:get") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
}) })
} }
) )
@ -172,7 +154,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:get") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
}) })
} }
) )
@ -215,7 +197,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -254,7 +236,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:create") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -313,7 +295,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:delete") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -349,7 +331,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:create") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -393,7 +375,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:create") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -436,7 +418,7 @@ public interface ApplicationManagementAPI {
tags = "Application Management", tags = "Application Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )
@ -475,7 +457,7 @@ public interface ApplicationManagementAPI {
tags = "Lifecycle Management", tags = "Lifecycle Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:lifecycle:get") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
}) })
} }
) )
@ -507,7 +489,7 @@ public interface ApplicationManagementAPI {
tags = "Lifecycle Management", tags = "Lifecycle Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:lifecycle:add") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
}) })
} }
) )

@ -1,350 +1,206 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Schema WSO2DM_APPM_DB -- Table AP_APP
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP (
-- ----------------------------------------------------- ID INT(11) NOT NULL AUTO_INCREMENT,
-- Table APPM_PLATFORM NAME VARCHAR(45) NOT NULL,
-- ----------------------------------------------------- TYPE VARCHAR(200) NOT NULL,
CREATE TABLE IF NOT EXISTS APPM_PLATFORM ( TENANT_ID VARCHAR(45) NOT NULL,
ID INT NOT NULL AUTO_INCREMENT UNIQUE, APP_CATEGORY VARCHAR(45) NULL DEFAULT NULL,
IDENTIFIER VARCHAR (100) NOT NULL, RESTRICTED INT(11) NOT NULL,
TENANT_ID INT NOT NULL , STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
NAME VARCHAR (255), SUB_TYPE VARCHAR(45) NOT NULL,
FILE_BASED BOOLEAN, CURRENCY VARCHAR(45) NULL DEFAULT '$',
DESCRIPTION LONGVARCHAR, DM_DEVICE_TYPE_ID INT(11) NOT NULL,
IS_SHARED BOOLEAN,
IS_DEFAULT_TENANT_MAPPING BOOLEAN,
ICON_NAME VARCHAR (100),
PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS APPM_PLATFORM_PROPERTIES (
ID INT NOT NULL AUTO_INCREMENT,
PLATFORM_ID INT NOT NULL,
PROP_NAME VARCHAR (100) NOT NULL,
OPTIONAL BOOLEAN,
DEFAUL_VALUE VARCHAR (255),
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME)
);
CREATE TABLE IF NOT EXISTS APPM_PLATFORM_TENANT_MAPPING (
ID INT NOT NULL AUTO_INCREMENT,
TENANT_ID INT NOT NULL ,
PLATFORM_ID INT NOT NULL,
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
PRIMARY KEY (ID, TENANT_ID, PLATFORM_ID)
);
CREATE INDEX IF NOT EXISTS FK_PLATFROM_TENANT_MAPPING_PLATFORM ON APPM_PLATFORM_TENANT_MAPPING(PLATFORM_ID ASC);
-- -----------------------------------------------------
-- Table APPM_APPLICATION_CATEGORY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_CATEGORY (
ID INT NOT NULL AUTO_INCREMENT,
NAME VARCHAR(100) NOT NULL UNIQUE,
DESCRIPTION TEXT NULL,
PRIMARY KEY (ID)); PRIMARY KEY (ID));
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('Sports', 'Applications that involve sports.');
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('Education', 'Application related with education');
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('News', 'Applications involving news');
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_LIFECYCLE_STATE` -- Table AP_APP_RELEASE
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_LIFECYCLE_STATE ( CREATE TABLE IF NOT EXISTS AP_APP_RELEASE (
ID INT NOT NULL AUTO_INCREMENT UNIQUE, ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(100) NOT NULL, VERSION VARCHAR(10) NOT NULL,
IDENTIFIER VARCHAR(100) NOT NULL, TENANT_ID VARCHAR(45) NOT NULL,
DESCRIPTION TEXT NULL, UUID VARCHAR(200) NOT NULL,
RELEASE_TYPE VARCHAR(45) NOT NULL,
APP_PRICE DECIMAL(6,2) NULL DEFAULT NULL,
STORED_LOCATION VARCHAR(45) NOT NULL,
BANNER_LOCATION VARCHAR(45) NOT NULL,
SC_1_LOCATION VARCHAR(45) NOT NULL,
SC_2_LOCATION VARCHAR(45) NULL DEFAULT NULL,
SC_3_LOCATION VARCHAR(45) NULL DEFAULT NULL,
APP_HASH_VALUE VARCHAR(1000) NOT NULL,
SHARED_WITH_ALL_TENANTS INT(11) NULL DEFAULT NULL,
APP_META_INFO VARCHAR(20000) NULL DEFAULT NULL,
RATING DOUBLE NULL DEFAULT NULL,
RATED_USERS INT(11) NULL,
AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID, AP_APP_ID),
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID));
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 AP_APP_REVIEW (
ID INT(11) NOT NULL AUTO_INCREMENT,
TENANT_ID VARCHAR(45) NOT NULL,
COMMENT VARCHAR(250) NOT NULL,
REPLY_COMMENT VARCHAR(250) NULL,
CREATED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
MODEFIED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
RATING INT(11) NULL,
USERNAME VARCHAR(45) NOT NULL,
AP_APP_RELEASE_ID INT(11) NOT NULL,
AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
UNIQUE INDEX APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE (IDENTIFIER ASC)); CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) VALUES ('CREATED', 'CREATED', 'Application creation REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
initial state');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('IN REVIEW', 'IN REVIEW', 'Application is in in-review state');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('APPROVED', 'APPROVED', 'State in which Application is approved after reviewing.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('REJECTED', 'REJECTED', 'State in which Application is rejected after reviewing.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('PUBLISHED', 'PUBLISHED', 'State in which Application is in published state.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('UNPUBLISHED', 'UNPUBLISHED', 'State in which Application is in un published state.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('RETIRED', 'RETIRED', 'Retiring an application to indicate end of life state,');
CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
CREATE TABLE IF NOT EXISTS APPM_LC_STATE_TRANSITION
(
ID INT NOT NULL AUTO_INCREMENT UNIQUE,
INITIAL_STATE INT,
NEXT_STATE INT,
PERMISSION VARCHAR(1024),
DESCRIPTION VARCHAR(2048),
PRIMARY KEY (INITIAL_STATE, NEXT_STATE),
FOREIGN KEY (INITIAL_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE,
FOREIGN KEY (NEXT_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE
);
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(1, 2, null, 'Submit for review');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 1, null, 'Revoke from review');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 3, '/permission/admin/manage/device-mgt/application/review', 'APPROVE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(5, 6, null, 'UN PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(4, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 7, null, 'Retire');
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_APPLICATION -- Table AP_APP_LIFECYCLE_STATE
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` ( CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE (
`ID` INT NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
`UUID` VARCHAR(100) NOT NULL, CURRENT_STATE VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NOT NULL, PREVIOUSE_STATE VARCHAR(45) NOT NULL,
`SHORT_DESCRIPTION` VARCHAR(255) NULL, TENANT_ID VARCHAR(45) NOT NULL,
`DESCRIPTION` TEXT NULL, UPDATED_BY VARCHAR(100) NOT NULL,
`SCREEN_SHOT_COUNT` INT DEFAULT 0, UPDATED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`VIDEO_NAME` VARCHAR(100) NULL, AP_APP_RELEASE_ID INT(11) NOT NULL,
`CREATED_BY` VARCHAR(255) NULL, AP_APP_ID INT(11) NOT NULL,
`CREATED_AT` DATETIME NOT NULL, PRIMARY KEY (ID, AP_APP_RELEASE_ID, AP_APP_ID),
`MODIFIED_AT` DATETIME NULL, CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
`IS_FREE` TINYINT(1) NULL, FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
`PAYMENT_CURRENCY` VARCHAR(45) NULL, REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
`PAYMENT_PRICE` DECIMAL(10,2) NULL,
`APPLICATION_CATEGORY_ID` INT NOT NULL,
`LIFECYCLE_STATE_ID` INT NOT NULL,
`LIFECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL,
`LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL,
`TENANT_ID` INT NOT NULL,
`PLATFORM_ID` INT NOT NULL,
PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `LIFECYCLE_STATE_ID`, `PLATFORM_ID`),
UNIQUE INDEX `UUID_UNIQUE` (`UUID` ASC),
FOREIGN KEY (`APPLICATION_CATEGORY_ID`)
REFERENCES `APPM_APPLICATION_CATEGORY` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_APPM_APPLICATION_APPM_LIFECYCLE_STATE1`
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);
CREATE INDEX IF NOT EXISTS FK_APPLICATION_APPLICATION_CATEGORY ON APPM_APPLICATION(APPLICATION_CATEGORY_ID ASC);
-- ----------------------------------------------------- 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 APPM_APPLICATION_PROPERTY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTY (
PROP_KEY VARCHAR(255) NOT NULL,
PROP_VAL TEXT NULL,
APPLICATION_ID INT NOT NULL,
PRIMARY KEY (PROP_KEY, APPLICATION_ID),
CONSTRAINT FK_APPLICATION_PROPERTY_APPLICATION
FOREIGN KEY (APPLICATION_ID)
REFERENCES APPM_APPLICATION (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_APPLICATION_PROPERTY_APPLICATION ON APPM_APPLICATION_PROPERTY(APPLICATION_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_APPLICATION_RELEASE -- Table AP_APP_TAG
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_RELEASE ( CREATE TABLE IF NOT EXISTS AP_APP_TAG (
ID INT NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
VERSION_NAME VARCHAR(100) NOT NULL, TENANT_ID VARCHAR(45) NOT NULL,
RELEASE_RESOURCE TEXT NULL, TAG VARCHAR(45) NOT NULL,
RELEASE_CHANNEL VARCHAR(50) DEFAULT 'ALPHA', AP_APP_ID INT(11) NOT NULL,
RELEASE_DETAILS TEXT NULL, PRIMARY KEY (ID),
CREATED_AT DATETIME NOT NULL, CONSTRAINT fk_AP_APP_TAGS_AP_APP1
APPM_APPLICATION_ID INT NOT NULL, FOREIGN KEY (AP_APP_ID)
IS_DEFAULT TINYINT NULL, REFERENCES AP_APP (ID));
PRIMARY KEY (APPM_APPLICATION_ID, VERSION_NAME),
CONSTRAINT FK_APPLICATION_VERSION_APPLICATION
FOREIGN KEY (APPM_APPLICATION_ID)
REFERENCES APPM_APPLICATION (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_APPLICATION_VERSION_APPLICATION ON APPM_APPLICATION_RELEASE(APPM_APPLICATION_ID ASC);
-- ----------------------------------------------------- CREATE INDEX fk_AP_APP_TAGS_AP_APP1_idx ON AP_APP_TAG (AP_APP_ID ASC);
-- Table APPM_RELEASE_PROPERTY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_RELEASE_PROPERTY (
PROP_KEY VARCHAR(255) NOT NULL,
PROP_VALUE TEXT NULL,
APPLICATION_RELEASE_ID INT NOT NULL,
PRIMARY KEY (PROP_KEY, APPLICATION_RELEASE_ID),
CONSTRAINT FK_RELEASE_PROPERTY_APPLICATION_RELEASE
FOREIGN KEY (APPLICATION_RELEASE_ID)
REFERENCES APPM_APPLICATION_RELEASE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_RELEASE_PROPERTY_APPLICATION_RELEASE ON APPM_RELEASE_PROPERTY(APPLICATION_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_RESOURCE_TYPE -- Table AP_DEVICE_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_RESOURCE_TYPE ( CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION (
ID INT NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(45) NULL, TENANT_ID VARCHAR(45) NOT NULL,
DESCRIPTION TEXT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
PRIMARY KEY (ID)); SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
DM_ENROLMENT_ID INT(11) NOT NULL,
AP_APP_RELEASE_ID INT(11) NOT NULL,
AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_ID , AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (AP_APP_ID , ID));
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('PUBLIC', 'OPEN VISIBILITY, CAN BE VIEWED BY ALL LOGGED IN USERS'); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_ID ASC, AP_APP_RELEASE_ID ASC);
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('ROLES', 'ROLE BASED RESTRICTION, CAN BE VIEWED BY ONLY GIVEN
SET OF USER WHO HAVE THE SPECIFIED ROLE');
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('DEVICE_GROUPS', 'DEVICE GROUP LEVEL RESTRICTION,
CAN BE VIEWED BY THE DEVICES/ROLES BELONG TO THE GROUP');
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_SUBSCRIPTION -- Table AP_GROUP_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_SUBSCRIPTION ( CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION (
ID INT NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
VALUE VARCHAR(255) NOT NULL, TENANT_ID VARCHAR(45) NOT NULL,
CREATED_AT DATETIME NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
RESOURCE_TYPE_ID INT NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
APPLICATION_ID INT NOT NULL, UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
APPLICATION_RELEASE_ID INT NULL, UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
PRIMARY KEY (ID, APPLICATION_ID, RESOURCE_TYPE_ID), UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
CONSTRAINT fk_APPM_APPLICATION_SUBSCRIPTION_APPM_RESOURCE_TYPE1 DM_GROUP_ID INT(11) NOT NULL,
FOREIGN KEY (RESOURCE_TYPE_ID) AP_APP_RELEASE_ID INT(11) NOT NULL,
REFERENCES APPM_RESOURCE_TYPE (ID) AP_APP_ID INT(11) NOT NULL,
ON DELETE NO ACTION PRIMARY KEY (ID),
ON UPDATE NO ACTION, CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
CONSTRAINT fk_APPM_APPLICATION_SUBSCRIPTION_APPM_APPLICATION1 FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
FOREIGN KEY (APPLICATION_ID) REFERENCES AP_APP_RELEASE (ID , AP_APP_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);
CREATE INDEX FK_APPLICATION_SUBSCRIPTION_RESOURCE_TYPE ON APPM_SUBSCRIPTION(RESOURCE_TYPE_ID ASC);
CREATE INDEX FK_APPLICATION_SUBSCRIPTION_APPLICATION ON APPM_SUBSCRIPTION(APPLICATION_ID ASC);
CREATE INDEX FK_APPLICATION_SUBSCRIPTION_APPLICATION_RELEASE ON APPM_SUBSCRIPTION(APPLICATION_RELEASE_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 APPM_COMMENT
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_COMMENT (
ID INT NOT NULL AUTO_INCREMENT,
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 NOT NULL,
CREATED_BY VARCHAR(45) NULL,
MODIFIED_AT DATETIME NULL,
PUBLISHED TINYINT NULL,
APPROVED TINYINT NULL,
PRIMARY KEY (ID, APPLICATION_RELEASE_ID),
CONSTRAINT FK_APPLICATION_COMMENTS_APPLICATION_RELEASE
FOREIGN KEY (APPLICATION_RELEASE_ID)
REFERENCES APPM_APPLICATION_RELEASE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_APPLICATION_COMMENTS_APPLICATION_RELEASE ON APPM_COMMENT(APPLICATION_RELEASE_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_PLATFORM_TAG -- Table AP_ROLE_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_PLATFORM_TAG ( CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION (
NAME VARCHAR(100) NOT NULL, ID INT(11) NOT NULL AUTO_INCREMENT,
PLATFORM_ID INT NOT NULL, TENANT_ID VARCHAR(45) NOT NULL,
PRIMARY KEY (PLATFORM_ID, name), ROLE_NAME VARCHAR(100) NOT NULL,
CONSTRAINT fk_APPM_SUPPORTED_PLATFORM_TAGS_APPM_SUPPORTED_PLATFORM1 SUBSCRIBED_BY VARCHAR(100) NOT NULL,
FOREIGN KEY (PLATFORM_ID) SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
REFERENCES APPM_PLATFORM (ID) UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
ON DELETE CASCADE UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
ON UPDATE CASCADE); UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INT(11) NOT NULL,
CREATE INDEX FK_PLATFORM_TAGS_PLATFORM ON APPM_PLATFORM_TAG(PLATFORM_ID ASC); AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
-- ----------------------------------------------------- CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
-- Table APPM_APPLICATION_TAG
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_APPLICATION_TAG (
name VARCHAR(45) NOT NULL,
APPLICATION_ID INT NOT NULL,
PRIMARY KEY (APPLICATION_ID, name),
CONSTRAINT fk_APPM_APPLICATION_TAG_APPM_APPLICATION1
FOREIGN KEY (APPLICATION_ID)
REFERENCES APPM_APPLICATION (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE INDEX FK_APPLICATION_TAG_APPLICATION ON APPM_APPLICATION_TAG(APPLICATION_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_VISIBILITY -- Table AP_UNRESTRICTED_ROLE
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_VISIBILITY ( CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE (
ID INT NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
VALUE VARCHAR(255), TENANT_ID VARCHAR(45) NOT NULL,
RESOURCE_TYPE_ID INT NOT NULL, ROLE VARCHAR(45) NOT NULL,
APPLICATION_ID INT NULL, AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_APPM_VISIBILITY_APPM_RESOURCE_TYPE1 CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
FOREIGN KEY (RESOURCE_TYPE_ID) FOREIGN KEY (AP_APP_ID)
REFERENCES APPM_RESOURCE_TYPE (ID) 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);
CONSTRAINT fk_APPM_VISIBILITY_APPM_APPLICATION1
FOREIGN KEY (APPLICATION_ID)
REFERENCES APPM_APPLICATION (ID)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE INDEX FK_APPM_VISIBILITY_RESOURCE_TYPE ON APPM_VISIBILITY(RESOURCE_TYPE_ID ASC);
CREATE INDEX FK_VISIBILITY_APPLICATION ON APPM_VISIBILITY(APPLICATION_ID ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table APPM_SUBSCRIPTION_PROPERTIES -- Table AP_USER_SUBSCRIPTION
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_SUBSCRIPTION_PROPERTIES ( CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION (
PROP_KEY VARCHAR(500) NOT NULL, ID INT(11) NOT NULL AUTO_INCREMENT,
PROP_VALUE VARCHAR(500) NULL, TENANT_ID VARCHAR(45) NOT NULL,
APPM_SUBSCRIPTION_ID INT NOT NULL, USER_NAME VARCHAR(100) NOT NULL,
PRIMARY KEY (PROP_KEY, APPM_SUBSCRIPTION_ID), SUBSCRIBED_BY VARCHAR(100) NOT NULL,
CONSTRAINT fk_APPM_SUBSCRIPTION_PROPERTIES_APPM_SUBSCRIPTION1 SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (APPM_SUBSCRIPTION_ID) UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
REFERENCES APPM_SUBSCRIPTION (ID) UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
ON DELETE NO ACTION UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
ON UPDATE NO ACTION); AP_APP_RELEASE_ID INT(11) NOT NULL,
AP_APP_ID INT(11) NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
CREATE INDEX FK_SUBSCRIPTION_PROPERTIES_SUBSCRIPTION ON APPM_SUBSCRIPTION_PROPERTIES(APPM_SUBSCRIPTION_ID ASC); CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);

@ -1,5 +1,5 @@
-- MySQL Script generated by MySQL Workbench -- MySQL Script generated by MySQL Workbench
-- 2017-06-14 12:46:43 +0530 -- Tue 18 Sep 2018 17:40:45 +0530
-- Model: New Model Version: 1.0 -- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering -- MySQL Workbench Forward Engineering
@ -7,401 +7,252 @@ SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_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'; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema WSO2DM_APPM_DB
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Table `APPM_PLATFORM`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS APPM_PLATFORM (
ID INT NOT NULL AUTO_INCREMENT UNIQUE,
IDENTIFIER VARCHAR (100) NOT NULL,
TENANT_ID INT NOT NULL ,
NAME VARCHAR (255),
FILE_BASED BOOLEAN,
DESCRIPTION VARCHAR (2048),
IS_SHARED BOOLEAN,
IS_DEFAULT_TENANT_MAPPING BOOLEAN,
ICON_NAME VARCHAR (100),
PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS APPM_PLATFORM_PROPERTIES (
ID INT NOT NULL AUTO_INCREMENT,
PLATFORM_ID INT NOT NULL,
PROP_NAME VARCHAR (100) NOT NULL,
OPTIONAL BOOLEAN,
DEFAUL_VALUE VARCHAR (255),
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME)
);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_PLATFORM_TENENT_MAPPING` -- Table `AP_APP`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TENANT_MAPPING` ( CREATE TABLE IF NOT EXISTS `AP_APP` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`PLATFORM_ID` INT NOT NULL, `NAME` VARCHAR(45) NOT NULL,
`TENANT_ID` INT NOT NULL, `TYPE` VARCHAR(200) NOT NULL,
PRIMARY KEY (`ID`, `PLATFORM_ID`), `TENANT_ID` VARCHAR(45) NOT NULL,
INDEX `FK_PLATFROM_TENANT_MAPPING_PLATFORM` (`PLATFORM_ID` ASC), `APP_CATEGORY` VARCHAR(45) NULL DEFAULT NULL,
CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` `RESTRICTED` INT(11) NOT NULL,
FOREIGN KEY (`PLATFORM_ID`) `STATUS` VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
REFERENCES `APPM_PLATFORM` (`ID`) `SUB_TYPE` VARCHAR(45) NOT NULL,
ON DELETE CASCADE `CURRENCY` VARCHAR(45) NULL DEFAULT '$',
ON UPDATE CASCADE ) `DM_DEVICE_TYPE_ID` INT(11) NOT NULL,
ENGINE = InnoDB
COMMENT = 'This table contains the data related relationship between application platofrm and appication mappings';
-- -----------------------------------------------------
-- Table `APPM_APPLICATION_CATEGORY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_CATEGORY` (
`ID` INT NOT NULL AUTO_INCREMENT,
`NAME` VARCHAR(100) NOT NULL UNIQUE,
`DESCRIPTION` TEXT NULL,
PRIMARY KEY (`ID`)) PRIMARY KEY (`ID`))
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application category'; DEFAULT CHARACTER SET = utf8;
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('Sports', 'Applications that involve sports.');
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('Education', 'Application related with education'); -- -----------------------------------------------------
INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION) VALUES ('News', 'Applications involving news'); -- Table `AP_APP_RELEASE`
-- -----------------------------------------------------
-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AP_APP_RELEASE` (
-- Table `APPM_LIFECYCLE_STATE` `ID` INT(11) NOT NULL AUTO_INCREMENT,
-- ----------------------------------------------------- `VERSION` VARCHAR(10) NOT NULL,
CREATE TABLE IF NOT EXISTS APPM_LIFECYCLE_STATE ( `TENANT_ID` VARCHAR(45) NOT NULL,
ID INT NOT NULL AUTO_INCREMENT UNIQUE, `UUID` VARCHAR(200) NOT NULL,
NAME VARCHAR(100) NOT NULL, `RELEASE_TYPE` VARCHAR(45) NOT NULL,
IDENTIFIER VARCHAR(100) NOT NULL, `APP_PRICE` DECIMAL(6,2) NULL DEFAULT NULL,
DESCRIPTION TEXT NULL, `STORED_LOCATION` VARCHAR(45) NOT NULL,
PRIMARY KEY (ID), `BANNER_LOCATION` VARCHAR(45) NOT NULL,
UNIQUE INDEX APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE (IDENTIFIER ASC)); `SC_1_LOCATION` VARCHAR(45) NOT NULL,
`SC_2_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) VALUES ('CREATED', 'CREATED', `SC_3_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
'Application creation initial state'); `APP_HASH_VALUE` VARCHAR(1000) NOT NULL,
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) `SHARED_WITH_ALL_TENANTS` INT(11) NULL DEFAULT NULL,
VALUES ('IN REVIEW', 'IN REVIEW', 'Application is in in-review state'); `APP_META_INFO` VARCHAR(20000) NULL DEFAULT NULL,
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) `RATING` DOUBLE NULL DEFAULT NULL,
VALUES ('APPROVED', 'APPROVED', 'State in which Application is approved after reviewing.'); `RATED_USERS` INT(11) NULL,
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) `AP_APP_ID` INT(11) NOT NULL,
VALUES ('REJECTED', 'REJECTED', 'State in which Application is rejected after reviewing.'); PRIMARY KEY (`ID`, `AP_APP_ID`),
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1`
VALUES ('PUBLISHED', 'PUBLISHED', 'State in which Application is in published state.'); FOREIGN KEY (`AP_APP_ID`)
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) REFERENCES `AP_APP` (`ID`)
VALUES ('UNPUBLISHED', 'UNPUBLISHED', 'State in which Application is in un published state.');
INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION)
VALUES ('RETIRED', 'RETIRED', 'Retiring an application to indicate end of life state,');
CREATE TABLE IF NOT EXISTS APPM_LC_STATE_TRANSITION
(
ID INT NOT NULL AUTO_INCREMENT UNIQUE,
INITIAL_STATE INT,
NEXT_STATE INT,
PERMISSION VARCHAR(1024),
DESCRIPTION VARCHAR(2048),
PRIMARY KEY (INITIAL_STATE, NEXT_STATE),
FOREIGN KEY (INITIAL_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE,
FOREIGN KEY (NEXT_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE
);
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(1, 2, null, 'Submit for review');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 1, null, 'Revoke from review');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 3, '/permission/admin/manage/device-mgt/application/review', 'APPROVE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(2, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(3, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(5, 6, null, 'UN PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 5, null, 'PUBLISH');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(4, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 1, null, 'Return to CREATE STATE');
INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES
(6, 7, null, 'Retire');
-- -----------------------------------------------------
-- Table `APPM_APPLICATION`
-- -----------------------------------------------------
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,
`VIDEO_NAME` VARCHAR(100) NULL,
`SCREEN_SHOT_COUNT` INT DEFAULT 0,
`CREATED_BY` VARCHAR(255) NULL,
`CREATED_AT` DATETIME NOT NULL,
`MODIFIED_AT` DATETIME NULL,
`IS_FREE` TINYINT(1) NULL,
`PAYMENT_CURRENCY` VARCHAR(45) NULL,
`PAYMENT_PRICE` DECIMAL(10,2) NULL,
`APPLICATION_CATEGORY_ID` INT NOT NULL,
`LIFECYCLE_STATE_ID` INT NOT NULL,
`LIFECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL,
`LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL,
`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_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_LIFECYCLE_STATE1`
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 DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the applications'; DEFAULT CHARACTER SET = utf8
COMMENT = ' ';
CREATE INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` ON `AP_APP_RELEASE` (`AP_APP_ID` ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_APPLICATION_PROPERTY` -- Table `AP_APP_REVIEW`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_PROPERTY` ( CREATE TABLE IF NOT EXISTS `AP_APP_REVIEW` (
`PROP_KEY` VARCHAR(255) NOT NULL, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`PROP_VAL` TEXT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
`APPLICATION_ID` INT NOT NULL, `COMMENT` VARCHAR(250) NOT NULL,
PRIMARY KEY (`PROP_KEY`, `APPLICATION_ID`), `REPLY_COMMENT` VARCHAR(250) NULL,
INDEX `FK_APPLICATION_PROPERTY_APPLICATION` (`APPLICATION_ID` ASC), `CREATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT `FK_APPLICATION_PROPERTY_APPLICATION` `MODEFIED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (`APPLICATION_ID`) `RATING` INT(11) NULL,
REFERENCES `APPM_APPLICATION` (`ID`) `USERNAME` VARCHAR(45) NOT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
CONSTRAINT `fk_AP_APP_COMMENT_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the properties that related to the application'; DEFAULT CHARACTER SET = utf8;
CREATE INDEX `fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx` ON `AP_APP_REVIEW` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_APPLICATION_RELEASE` -- Table `AP_APP_LIFECYCLE_STATE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_RELEASE` ( CREATE TABLE IF NOT EXISTS `AP_APP_LIFECYCLE_STATE` (
`ID` INT NOT NULL AUTO_INCREMENT UNIQUE , `ID` INT(11) NOT NULL AUTO_INCREMENT,
`VERSION_NAME` VARCHAR(100) NOT NULL, `CURRENT_STATE` VARCHAR(45) NOT NULL,
`RELEASE_RESOURCE` TEXT NULL, `PREVIOUSE_STATE` VARCHAR(45) NOT NULL,
`RELEASE_CHANNEL` VARCHAR(50) DEFAULT 'ALPHA', `TENANT_ID` VARCHAR(45) NOT NULL,
`RELEASE_DETAILS` TEXT NULL, `UPDATED_BY` VARCHAR(100) NOT NULL,
`CREATED_AT` DATETIME NOT NULL, `UPDATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`APPM_APPLICATION_ID` INT NOT NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`IS_DEFAULT` TINYINT(1) NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`APPM_APPLICATION_ID`, `VERSION_NAME`), PRIMARY KEY (`ID`, `AP_APP_RELEASE_ID`, `AP_APP_ID`),
INDEX `FK_APPLICATION_VERSION_APPLICATION` (`APPM_APPLICATION_ID` ASC), CONSTRAINT `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1`
CONSTRAINT `FK_APPLICATION_VERSION_APPLICATION` FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
FOREIGN KEY (`APPM_APPLICATION_ID`) REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
REFERENCES `APPM_APPLICATION` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application releases'; DEFAULT CHARACTER SET = utf8;
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 `APPM_RELEASE_PROPERTY` -- Table `AP_APP_TAG`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_RELEASE_PROPERTY` ( CREATE TABLE IF NOT EXISTS `AP_APP_TAG` (
`PROP_KEY` VARCHAR(255) NOT NULL, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`PROP_VALUE` TEXT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
`APPLICATION_RELEASE_ID` INT NOT NULL, `TAG` VARCHAR(45) NOT NULL,
PRIMARY KEY (`PROP_KEY`, `APPLICATION_RELEASE_ID`), `AP_APP_ID` INT(11) NOT NULL,
INDEX `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), PRIMARY KEY (`ID`),
CONSTRAINT `FK_RELEASE_PROPERTY_APPLICATION_RELEASE` CONSTRAINT `fk_AP_APP_TAGS_AP_APP1`
FOREIGN KEY (`APPLICATION_RELEASE_ID`) FOREIGN KEY (`AP_APP_ID`)
REFERENCES `APPM_APPLICATION_RELEASE` (`ID`) REFERENCES `AP_APP` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the properties that related to the application release'; DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- 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;
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('PUBLIC', 'OPEN VISIBILITY, CAN BE VIEWED BY ALL LOGGED IN USERS'); CREATE INDEX `fk_AP_APP_TAGS_AP_APP1_idx` ON `AP_APP_TAG` (`AP_APP_ID` ASC);
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('ROLES', 'ROLE BASED RESTRICTION, CAN BE VIEWED BY ONLY GIVEN
SET OF USER WHO HAVE THE SPECIFIED ROLE');
INSERT INTO APPM_RESOURCE_TYPE (NAME , DESCRIPTION) VALUES ('DEVICE_GROUPS', 'DEVICE GROUP LEVEL RESTRICTION,
CAN BE VIEWED BY THE DEVICES/ROLES BELONG TO THE GROUP');
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_SUBSCRIPTION` -- Table `AP_DEVICE_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION` ( CREATE TABLE IF NOT EXISTS `AP_DEVICE_SUBSCRIPTION` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`VALUE` VARCHAR(255) NOT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
`CREATED_AT` DATETIME NOT NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`RESOURCE_TYPE_ID` INT NOT NULL, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`APPLICATION_ID` INT NOT NULL, `UNSUBSCRIBED` INT(11) NULL DEFAULT NULL,
`APPLICATION_RELEASE_ID` INT NULL, `UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`ID`, `APPLICATION_ID`, `RESOURCE_TYPE_ID`), `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
INDEX `FK_APPLICATION_SUBSCRIPTION_RESOURCE_TYPE` (`RESOURCE_TYPE_ID` ASC), `DM_ENROLMENT_ID` INT(11) NOT NULL,
INDEX `FK_APPLICATION_SUBSCRIPTION_APPLICATION` (`APPLICATION_ID` ASC), `AP_APP_RELEASE_ID` INT(11) NOT NULL,
INDEX `FK_APPLICATION_SUBSCRIPTION_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), `AP_APP_ID` INT(11) NOT NULL,
CONSTRAINT `fk_APPM_APPLICATION_SUBSCRIPTION_APPM_RESOURCE_TYPE1` PRIMARY KEY (`ID`),
FOREIGN KEY (`RESOURCE_TYPE_ID`) CONSTRAINT `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1`
REFERENCES `APPM_RESOURCE_TYPE` (`ID`) FOREIGN KEY (`AP_APP_ID` , `AP_APP_RELEASE_ID`)
ON DELETE NO ACTION REFERENCES `AP_APP_RELEASE` (`AP_APP_ID` , `ID`)
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 DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application subscriptions'; DEFAULT CHARACTER SET = utf8;
CREATE INDEX `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_DEVICE_SUBSCRIPTION` (`AP_APP_ID` ASC, `AP_APP_RELEASE_ID` ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_COMMENT` -- Table `AP_GROUP_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_COMMENT` ( CREATE TABLE IF NOT EXISTS `AP_GROUP_SUBSCRIPTION` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`APPLICATION_RELEASE_ID` INT NOT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
`COMMENT_SUBJECT` VARCHAR(255) NULL, `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
`COMMENT_BODY` TEXT NULL, `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`RATING` INT NULL, `UNSUBSCRIBED` INT(11) NULL DEFAULT NULL,
`PARENT_ID` INT NULL, `UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL,
`CREATED_AT` DATETIME NOT NULL, `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`CREATED_BY` VARCHAR(45) NULL, `DM_GROUP_ID` INT(11) NOT NULL,
`MODIFIED_AT` DATETIME NULL, `AP_APP_RELEASE_ID` INT(11) NOT NULL,
`PUBLISHED` TINYINT(1) NULL, `AP_APP_ID` INT(11) NOT NULL,
`APPROVED` TINYINT(1) NULL, PRIMARY KEY (`ID`),
PRIMARY KEY (`ID`, `APPLICATION_RELEASE_ID`), CONSTRAINT `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1`
INDEX `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` (`APPLICATION_RELEASE_ID` ASC), FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
CONSTRAINT `FK_APPLICATION_COMMENTS_APPLICATION_RELEASE` REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
FOREIGN KEY (`APPLICATION_RELEASE_ID`)
REFERENCES `APPM_APPLICATION_RELEASE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application comments'; DEFAULT CHARACTER SET = utf8;
CREATE INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_GROUP_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
-- -----------------------------------------------------
-- Table `APPM_PLATFORM_TAG`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TAG` (
`name` VARCHAR(100) NOT NULL,
`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 (`PLATFORM_ID`)
REFERENCES `APPM_PLATFORM` (`ID`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
COMMENT = 'This table contains the data related to the app platform tag';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_APPLICATION_TAG` -- Table `AP_ROLE_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_TAG` ( CREATE TABLE IF NOT EXISTS `AP_ROLE_SUBSCRIPTION` (
`NAME` VARCHAR(45) NOT NULL, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`APPLICATION_ID` INT NOT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
PRIMARY KEY (`APPLICATION_ID`, `NAME`), `ROLE_NAME` VARCHAR(100) NOT NULL,
INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPLICATION_ID` ASC), `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1` `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (`APPLICATION_ID`) `UNSUBSCRIBED` INT(11) NULL DEFAULT NULL,
REFERENCES `APPM_APPLICATION` (`ID`) `UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB ENGINE = InnoDB
COMMENT = 'This table contains the data related to the application tags'; DEFAULT CHARACTER SET = utf8;
CREATE INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_ROLE_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_VISIBILITY` -- Table `AP_UNRESTRICTED_ROLE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_VISIBILITY` ( CREATE TABLE IF NOT EXISTS `AP_UNRESTRICTED_ROLE` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`VALUE` VARCHAR(255), `TENANT_ID` VARCHAR(45) NOT NULL,
`RESOURCE_TYPE_ID` INT NOT NULL, `ROLE` VARCHAR(45) NOT NULL,
`APPLICATION_ID` INT NULL, `AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
INDEX `FK_APPM_VISIBILITY_RESOURCE_TYPE` (`RESOURCE_TYPE_ID` ASC), CONSTRAINT `fk_AP_APP_VISIBILITY_AP_APP1`
INDEX `FK_VISIBILITY_APPLICATION` (`APPLICATION_ID` ASC), FOREIGN KEY (`AP_APP_ID`)
CONSTRAINT `fk_APPM_VISIBILITY_APPM_RESOURCE_TYPE1` REFERENCES `AP_APP` (`ID`)
FOREIGN KEY (`RESOURCE_TYPE_ID`)
REFERENCES `APPM_RESOURCE_TYPE` (`ID`)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION, ON UPDATE NO ACTION)
CONSTRAINT `fk_APPM_VISIBILITY_APPM_APPLICATION1` ENGINE = InnoDB
FOREIGN KEY (`APPLICATION_ID`) DEFAULT CHARACTER SET = utf8;
REFERENCES `APPM_APPLICATION` (`ID`)
ON DELETE CASCADE CREATE INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` ON `AP_UNRESTRICTED_ROLE` (`AP_APP_ID` ASC);
ON UPDATE CASCADE )
ENGINE = InnoDB;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `APPM_SUBSCRIPTION_PROPERTIES` -- Table `AP_USER_SUBSCRIPTION`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION_PROPERTIES` ( CREATE TABLE IF NOT EXISTS `AP_USER_SUBSCRIPTION` (
`PROP_KEY` VARCHAR(255) NOT NULL, `ID` INT(11) NOT NULL AUTO_INCREMENT,
`PROP_VALUE` TEXT NULL, `TENANT_ID` VARCHAR(45) NOT NULL,
`APPM_SUBSCRIPTION_ID` INT NOT NULL, `USER_NAME` VARCHAR(100) NOT NULL,
PRIMARY KEY (`PROP_KEY`, `APPM_SUBSCRIPTION_ID`), `SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
INDEX `FK_SUBSCRIPTION_PROPERTIES_SUBSCRIPTION` (`APPM_SUBSCRIPTION_ID` ASC), `SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `fk_APPM_SUBSCRIPTION_PROPERTIES_APPM_SUBSCRIPTION1` `UNSUBSCRIBED` INT(11) NULL DEFAULT NULL,
FOREIGN KEY (`APPM_SUBSCRIPTION_ID`) `UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL,
REFERENCES `APPM_SUBSCRIPTION` (`ID`) `UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1`
FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
REFERENCES `AP_APP_RELEASE` (`ID` , `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;
-- ----------------------------------------------------- CREATE INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_USER_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
-- Table `APPM_DEVICE_APPLICATION_MAPPING`
-- -----------------------------------------------------
-- CREATE TABLE IF NOT EXISTS `APPM_DEVICE_APPLICATION_MAPPING` (
-- `ID` INT AUTO_INCREMENT NOT NULL,
-- `DEVICE_IDENTIFIER` VARCHAR(255) NOT NULL,
-- `APPLICATION_UUID` VARCHAR(100) NOT NULL,
-- `INSTALLED` BOOLEAN NOT NULL,
-- `SENT_AT` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- PRIMARY KEY (ID),
-- CONSTRAINT `fk_appm_application` FOREIGN KEY (`APPLICATION_UUID`) REFERENCES
-- APPM_APPLICATION (`UUID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
-- UNIQUE KEY `device_app_mapping` (`DEVICE_IDENTIFIER`, `APPLICATION_UUID`)
-- ) ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE; SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

Loading…
Cancel
Save