-
-
-
-
-
-
- Change Password
-
-
-
-
-
-
- Enter old password *
-
-
-
-
-
- Enter new password *
-
-
-
-
-
- Retype new password *
-
-
-
-
-
-
-
+
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css
index 3ae90e467d..acdff12e39 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css
@@ -2642,64 +2642,7 @@ ul.tiles .icon {
/* ========================================================================
* modal popup styles
* ======================================================================== */
-.modal-open {
- padding: 0 !important;
-}
-.modal {
- z-index: 100000001;
- padding: 0 !important;
-}
-
-.modal-backdrop {
- z-index: 100000000;
-}
-
-.modal-content {
- background: #222;
- color: #ffffff;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-.modal-header {
- border-bottom: none;
- padding: 15px 15px 0;
-}
-
-.modal-header .close {
- color: #ffffff;
- text-shadow: none;
- opacity: 0.8;
-}
-
-.modal-body {
- padding: 0 15px;
-}
-
-.modal-dialog {
- margin: 80px auto;
-}
-
-.modal-footer {
- border-top: none;
-}
-
-@media only screen and (max-width: 768px) {
- .modal {
- padding: 0 15px !important;
- }
-}
-
-@media only screen and (min-width: 1280px) {
- .modal-dialog {
- width: 1000px;
- }
-}
/* ========================================================================
* list group styles
@@ -4018,72 +3961,6 @@ a.btn-operations {
}
/* modal pop-up styles */
-.wr-modalpopup {
- display: none;
-}
-
-.wr-modalpopup .modalpopup-container {
- display: block;
- min-height: 100px;
- width: 100%;
- position: fixed;
- background: #11375B;
- color: #fff;
- z-index: 1000001;
- align-content: center;
- top: 50%;
-}
-
-.modalpopup-content {
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
- padding: 50px 60px 60px 60px;
-}
-
-.modalpopup-content h3 {
- font-weight: 300;
-}
-
-.modalpopup-content h3 .fw-stack {
- margin-right: 15px;
-}
-
-.wr-modalpopup .modalpopup-close-btn {
- color: #fff;
- z-index: 1000002;
- cursor: pointer;
- position: absolute;
- top: 20px;
- left: 20px;
- padding: 5px 8px;
- font-size: 18px;
-}
-
-.wr-modalpopup .modalpopup-close-btn:hover {
-
-}
-
-.wr-modalpopup .modalpopup-content .buttons {
- margin-top: 30px;
-}
-
-.wr-modalpopup .modalpopup-content .buttons .btn-operations {
- background: #fff;
- color: #333;
- text-transform: uppercase;
- font-weight: 500;
-}
-
-.wr-modalpopup .modalpopup-bg {
- position: fixed;
- z-index: 1000000;
- width: 100%;
- height: 100%;
- background: #000000;
- opacity: 0.9;
- display: block;
-}
/* notification panel styles */
.wr-notification-bar, .wr-side-panel {
@@ -6750,32 +6627,7 @@ ul.tiles .icon {
/* ========================================================================
* modal popup styles
* ======================================================================== */
-.modal-open {
- padding: 0 !important;
-}
-.modal {
- z-index: 100000001;
- padding: 0 !important;
-}
-.modal-backdrop {
- z-index: 0;
-}
-.modal-content {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-.modal-dialog {
- margin: 80px auto;
-}
-@media only screen and (max-width: 768px) {
- .modal {
- padding: 0 15px !important;
- }
-}
+
/* ========================================================================
* asset details styles
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/modal.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/modal.css
index 320e313906..77a3bb1502 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/modal.css
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/modal.css
@@ -17,77 +17,4 @@
*/
/* modal pop-up styles */
-.wr-modalpopup {
- display: none;
-}
-.wr-modalpopup .modalpopup-container {
- display: block;
- min-height: 100px;
- width: 100%;
- position: fixed;
- background: #11375B;
- color: #fff;
- z-index: 1000001;
- align-content: center;
- top: 50%;
- left: 0%;
-}
-
-.modalpopup-content {
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
- padding: 50px;
-}
-
-.center-container {
- left: 25%;
- right: 25%;
-}
-
-.modal-content {
- display: block;
- /*padding: 2em 1.4em;*/
- min-height: 110px;
- background: none;
- border: none;
- -webkit-box-shadow: none;
- box-shadow: none;
-}
-
-.modalpopup-content h3 {
- font-weight: 300;
- font-size: 15px;
-}
-
-.modalpopup-content h3 .fw-stack {
- margin-right: 15px;
-}
-
-.wr-modalpopup .modalpopup-close-btn {
- color: #fff;
- z-index: 1000002;
- cursor: pointer;
- position: absolute;
- top: 30px;
- left: 40px;
- padding: 5px 8px;
- font-size: 18px;
-}
-
-.wr-modalpopup .modalpopup-close-btn:hover {
-
-}
-
-.wr-modalpopup .modalpopup-bg {
- position: fixed;
- z-index: 1000000;
- width: 100%;
- height: 100%;
- background: #000000;
- opacity: 0.8;
- display: block;
- left: 0;
- top: 0;
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs
index a511639e8f..b298d71d3b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs
@@ -26,7 +26,7 @@
{{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}}
{{~css "less/theme.less" combine=false}}
- {{~css "css/theme-wso2.css"}}
+ {{~css "css/theme-wso2.css" combine=false}}
{{/zone}}
{{~#zone "topJs"}}
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql
index cd9560016a..4684ec127c 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql
@@ -145,10 +145,6 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
ON UPDATE NO ACTION
);
-
-
-
-
CREATE TABLE IF NOT EXISTS DM_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) DEFAULT NULL ,
@@ -168,9 +164,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
ON UPDATE NO ACTION
);
-
-
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT ,
DEVICE_ID INT(11) NOT NULL ,
@@ -190,9 +183,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ON UPDATE NO ACTION
);
-
-
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL ,
@@ -210,10 +200,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ON UPDATE NO ACTION
);
-
-
-
-
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ID INT(11) NOT NULL AUTO_INCREMENT,
PROFILE_ID INT(11) NOT NULL,
@@ -229,9 +215,6 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ON UPDATE NO ACTION
);
-
-
-
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT ,
ROLE_NAME VARCHAR(45) NOT NULL ,
@@ -244,9 +227,6 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
ON UPDATE NO ACTION
);
-
-
-
CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ID INT NOT NULL AUTO_INCREMENT ,
POLICY_ID INT NOT NULL ,
@@ -259,8 +239,7 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ON UPDATE NO ACTION
);
-
- CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
+CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
ID INT NOT NULL AUTO_INCREMENT ,
DEVICE_ID INT NOT NULL ,
ENROLMENT_ID INT(11) NOT NULL,
@@ -279,8 +258,6 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ON UPDATE NO ACTION
);
-
-
CREATE TABLE IF NOT EXISTS DM_CRITERIA (
ID INT NOT NULL AUTO_INCREMENT,
TENANT_ID INT NOT NULL,
@@ -288,8 +265,6 @@ CREATE TABLE IF NOT EXISTS DM_CRITERIA (
PRIMARY KEY (ID)
);
-
-
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
ID INT NOT NULL AUTO_INCREMENT,
CRITERIA_ID INT NOT NULL,
@@ -335,7 +310,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
PRIMARY KEY (ID)
);
-
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID INT NOT NULL AUTO_INCREMENT,
POLICY_ID INT NOT NULL,
@@ -344,7 +318,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
PRIMARY KEY (ID)
);
-
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ID INT NOT NULL AUTO_INCREMENT,
COMPLIANCE_STATUS_ID INT NOT NULL,
@@ -406,8 +379,6 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
);
-- NOTIFICATION TABLE END --
-DROP TABLE IF EXISTS DM_DEVICE_INFO;
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,
@@ -421,10 +392,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ON UPDATE NO ACTION
);
-
-
-DROP TABLE IF EXISTS DM_DEVICE_LOCATION;
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,
@@ -445,7 +412,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ON UPDATE NO ACTION
);
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL,
@@ -473,9 +439,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ON UPDATE NO ACTION
);
-
-- POLICY AND DEVICE GROUP MAPPING --
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
ID INT NOT NULL AUTO_INCREMENT,
DEVICE_GROUP_ID INT NOT NULL,
@@ -493,11 +457,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
-
-- END OF POLICY AND DEVICE GROUP MAPPING --
-- DASHBOARD RELATED VIEWS --
-
CREATE VIEW POLICY_COMPLIANCE_INFO AS
SELECT
DEVICE_INFO.DEVICE_ID,
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
index 6482fcb776..d230792327 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
@@ -1,31 +1,31 @@
CREATE TABLE DM_DEVICE_TYPE (
ID INTEGER IDENTITY(1,1) NOT NULL,
- NAME VARCHAR(50) DEFAULT NULL,
+ NAME VARCHAR(300) DEFAULT NULL,
+ PROVIDER_TENANT_ID INTEGER NULL,
+ SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT 0,
PRIMARY KEY (ID)
);
-CREATE TABLE DM_DEVICE_CERTIFICATE (
- ID INTEGER IDENTITY(1,1) NOT NULL,
- SERIAL_NUMBER VARCHAR(50) DEFAULT NULL,
- CERTIFICATE VARBINARY(255) DEFAULT NULL,
- PRIMARY KEY (ID)
-);
+CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME);
CREATE TABLE DM_DEVICE (
ID INTEGER IDENTITY(1,1) NOT NULL,
- DESCRIPTION TEXT DEFAULT NULL,
- NAME VARCHAR(50) DEFAULT NULL,
- DEVICE_TYPE_ID INTEGER DEFAULT NULL,
- DEVICE_IDENTIFICATION VARCHAR(50) DEFAULT NULL,
+ DESCRIPTION VARBINARY(255) DEFAULT NULL,
+ NAME VARCHAR(100) DEFAULT NULL,
+ DEVICE_TYPE_ID INTEGER DEFAULT NULL,
+ DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID)
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID);
+
CREATE TABLE DM_OPERATION (
ID INTEGER IDENTITY(1,1) NOT NULL,
- TYPE VARCHAR(50) NOT NULL,
+ TYPE VARCHAR(20) NOT NULL,
CREATED_TIMESTAMP DATETIME2 NOT NULL,
RECEIVED_TIMESTAMP DATETIME2 NULL,
OPERATION_CODE VARCHAR(50) NOT NULL,
@@ -80,11 +80,16 @@ CREATE TABLE DM_ENROLMENT (
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID);
+CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID);
+
CREATE TABLE DM_ENROLMENT_OP_MAPPING (
ID INTEGER IDENTITY(1,1) NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
STATUS VARCHAR(50) NULL,
+ CREATED_TIMESTAMP INTEGER NOT NULL,
+ UPDATED_TIMESTAMP INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE_OPERATION_MAPPING_DEVICE FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
@@ -92,11 +97,16 @@ CREATE TABLE DM_ENROLMENT_OP_MAPPING (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
+CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
+CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
+
CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
ID INTEGER IDENTITY(1,1) NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
OPERATION_RESPONSE VARBINARY(255) DEFAULT NULL,
+ RECEIVED_TIMESTAMP DATETIME2 DEFAULT NULL
PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE_OPERATION_RESP_ENROLMENT FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
@@ -104,10 +114,12 @@ CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENID_OPID ON DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID, ENROLMENT_ID);
+
-- POLICY RELATED TABLES --
-CREATE TABLE DM_PROFILE (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+CREATE TABLE DM_PROFILE (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
PROFILE_NAME VARCHAR(45) NOT NULL ,
TENANT_ID INTEGER NOT NULL ,
DEVICE_TYPE_ID INTEGER NOT NULL ,
@@ -118,8 +130,8 @@ CREATE TABLE DM_PROFILE (
DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_POLICY (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+CREATE TABLE DM_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
NAME VARCHAR(45) DEFAULT NULL ,
DESCRIPTION VARCHAR(1000) NULL,
TENANT_ID INTEGER NOT NULL ,
@@ -134,8 +146,8 @@ CREATE TABLE DM_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_DEVICE_POLICY (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+CREATE TABLE DM_DEVICE_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL ,
ENROLMENT_ID INTEGER NOT NULL,
DEVICE VARBINARY(255) NOT NULL,
@@ -147,8 +159,8 @@ CREATE TABLE DM_DEVICE_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_DEVICE_TYPE_POLICY (
- ID INTEGER NOT NULL ,
+CREATE TABLE DM_DEVICE_TYPE_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_TYPE_ID INTEGER NOT NULL ,
POLICY_ID INTEGER NOT NULL ,
PRIMARY KEY (ID) ,
@@ -158,11 +170,11 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_PROFILE_FEATURES (
- ID INTEGER NOT NULL IDENTITY(1,1),
+CREATE TABLE DM_PROFILE_FEATURES (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
PROFILE_ID INTEGER NOT NULL,
- FEATURE_CODE VARCHAR(30) NOT NULL,
- DEVICE_TYPE_ID INTEGER NOT NULL,
+ FEATURE_CODE VARCHAR(100) NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL,
TENANT_ID INTEGER NOT NULL ,
CONTENT VARBINARY(255) NULL DEFAULT NULL,
PRIMARY KEY (ID),
@@ -170,8 +182,8 @@ CREATE TABLE DM_PROFILE_FEATURES (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_ROLE_POLICY (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+CREATE TABLE DM_ROLE_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
ROLE_NAME VARCHAR(45) NOT NULL ,
POLICY_ID INTEGER NOT NULL ,
PRIMARY KEY (ID) ,
@@ -179,8 +191,8 @@ CREATE TABLE DM_ROLE_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
-CREATE TABLE DM_USER_POLICY (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+CREATE TABLE DM_USER_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
POLICY_ID INTEGER NOT NULL ,
USERNAME VARCHAR(45) NOT NULL ,
PRIMARY KEY (ID) ,
@@ -188,8 +200,8 @@ CREATE TABLE DM_USER_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
- CREATE TABLE DM_DEVICE_POLICY_APPLIED (
- ID INTEGER NOT NULL IDENTITY(1,1) ,
+ CREATE TABLE DM_DEVICE_POLICY_APPLIED (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL ,
ENROLMENT_ID INTEGER NOT NULL,
POLICY_ID INTEGER NOT NULL ,
@@ -205,14 +217,14 @@ CREATE TABLE DM_USER_POLICY (
);
CREATE TABLE DM_CRITERIA (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
TENANT_ID INTEGER NOT NULL,
NAME VARCHAR(50) NULL,
PRIMARY KEY (ID)
);
CREATE TABLE DM_POLICY_CRITERIA (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
CRITERIA_ID INTEGER NOT NULL,
POLICY_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
@@ -223,7 +235,7 @@ CREATE TABLE DM_POLICY_CRITERIA (
);
CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
POLICY_CRITERION_ID INTEGER NOT NULL,
PROP_KEY VARCHAR(45) NULL,
PROP_VALUE VARCHAR(100) NULL,
@@ -234,7 +246,7 @@ CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
);
CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
POLICY_ID INTEGER NOT NULL,
@@ -248,18 +260,18 @@ CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
);
CREATE TABLE DM_POLICY_CHANGE_MGT (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
POLICY_ID INTEGER NOT NULL,
- DEVICE_TYPE_ID INTEGER NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE DM_POLICY_COMPLIANCE_FEATURES (
- ID INTEGER NOT NULL IDENTITY(1,1),
+ ID INTEGER IDENTITY(1,1) NOT NULL,
COMPLIANCE_STATUS_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
- FEATURE_CODE VARCHAR(15) NOT NULL,
+ FEATURE_CODE VARCHAR(100) NOT NULL,
STATUS INTEGER NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS FOREIGN KEY (COMPLIANCE_STATUS_ID) REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
@@ -277,6 +289,8 @@ CREATE TABLE DM_APPLICATION (
LOCATION_URL VARCHAR(100) DEFAULT NULL,
IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES VARBINARY(255) NULL,
+ MEMORY_USAGE INTEGER NULL,
+ IS_ACTIVE BIT NOT NULL DEFAULT 0,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
);
@@ -295,6 +309,56 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
-- POLICY RELATED TABLES FINISHED --
+
+-- DEVICE GROUP TABLES --
+
+CREATE TABLE DM_GROUP (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ GROUP_NAME VARCHAR(100) DEFAULT NULL,
+ DESCRIPTION VARBINARY(255) NULL,
+ DATE_OF_CREATE BIGINT DEFAULT NULL,
+ DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
+ OWNER VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE DM_DEVICE_GROUP_MAP (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ DEVICE_ID INTEGER DEFAULT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+-- END OF DEVICE GROUP TABLES --
+
+-- POLICY AND DEVICE GROUP MAPPING --
+
+CREATE TABLE DM_DEVICE_GROUP_POLICY (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ DEVICE_GROUP_ID INTEGER NOT NULL,
+ POLICY_ID INTEGER NOT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
+ FOREIGN KEY (DEVICE_GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+-- END OF POLICY AND DEVICE GROUP MAPPING --
+
-- NOTIFICATION TABLE --
CREATE TABLE DM_NOTIFICATION (
NOTIFICATION_ID INTEGER IDENTITY(1,1) NOT NULL,
@@ -311,3 +375,126 @@ CREATE TABLE DM_NOTIFICATION (
);
-- NOTIFICATION TABLE END --
+CREATE TABLE DM_DEVICE_INFO (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ DEVICE_ID INTEGER NULL,
+ KEY_FIELD VARCHAR(45) NULL,
+ VALUE_FIELD VARCHAR(100) NULL,
+ PRIMARY KEY (ID),
+ INDEX DM_DEVICE_INFO_DEVICE_idx (DEVICE_ID ASC),
+ CONSTRAINT DM_DEVICE_INFO_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE DM_DEVICE_LOCATION (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ DEVICE_ID INTEGER NULL,
+ LATITUDE FLOAT NULL,
+ LONGITUDE FLOAT NULL,
+ STREET1 VARCHAR(45) NULL,
+ STREET2 VARCHAR(45) NULL,
+ CITY VARCHAR(45) NULL,
+ ZIP VARCHAR(10) NULL,
+ STATE VARCHAR(45) NULL,
+ COUNTRY VARCHAR(45) NULL,
+ UPDATE_TIMESTAMP INTEGER NOT NULL,
+ PRIMARY KEY (ID),
+ INDEX DM_DEVICE_LOCATION_DEVICE_idx (DEVICE_ID ASC),
+ CONSTRAINT DM_DEVICE_LOCATION_DEVICE
+ FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE DM_DEVICE_DETAIL (
+ ID INTEGER IDENTITY(1,1) NOT NULL,
+ DEVICE_ID INTEGER NOT NULL,
+ DEVICE_MODEL VARCHAR(45) NULL,
+ VENDOR VARCHAR(45) NULL,
+ OS_VERSION VARCHAR(45) NULL,
+ OS_BUILD_DATE VARCHAR(100) NULL,
+ BATTERY_LEVEL DECIMAL(4) NULL,
+ INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL,
+ INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL,
+ EXTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL,
+ EXTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL,
+ CONNECTION_TYPE VARCHAR(10) NULL,
+ SSID VARCHAR(45) NULL,
+ CPU_USAGE DECIMAL(5) NULL,
+ TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
+ AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
+ PLUGGED_IN INTEGER NULL,
+ UPDATE_TIMESTAMP INTEGER NOT NULL,
+ PRIMARY KEY (ID),
+ INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx (DEVICE_ID ASC),
+ CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
+ FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+-- DASHBOARD RELATED VIEWS --
+
+CREATE VIEW DEVICE_INFO_VIEW AS
+SELECT
+DM_DEVICE.ID AS DEVICE_ID,
+DM_DEVICE.DEVICE_IDENTIFICATION,
+DM_DEVICE_TYPE.NAME AS PLATFORM,
+DM_ENROLMENT.OWNERSHIP,
+DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
+DM_DEVICE.TENANT_ID
+FROM DM_DEVICE, DM_DEVICE_TYPE, DM_ENROLMENT
+WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID;
+
+CREATE VIEW DEVICE_WITH_POLICY_INFO_VIEW AS
+SELECT
+DEVICE_ID,
+POLICY_ID,
+STATUS AS IS_COMPLIANT
+FROM DM_POLICY_COMPLIANCE_STATUS;
+
+CREATE VIEW POLICY_COMPLIANCE_INFO AS
+SELECT
+DEVICE_INFO_VIEW.DEVICE_ID,
+DEVICE_INFO_VIEW.DEVICE_IDENTIFICATION,
+DEVICE_INFO_VIEW.PLATFORM,
+DEVICE_INFO_VIEW.OWNERSHIP,
+DEVICE_INFO_VIEW.CONNECTIVITY_STATUS,
+IFNULL(DEVICE_WITH_POLICY_INFO_VIEW.POLICY_ID, -1) AS POLICY_ID,
+IFNULL(DEVICE_WITH_POLICY_INFO_VIEW.IS_COMPLIANT, -1) AS IS_COMPLIANT,
+DEVICE_INFO_VIEW.TENANT_ID
+FROM
+DEVICE_INFO_VIEW
+LEFT JOIN
+DEVICE_WITH_POLICY_INFO_VIEW
+ON DEVICE_INFO_VIEW.DEVICE_ID = DEVICE_WITH_POLICY_INFO_VIEW.DEVICE_ID
+ORDER BY DEVICE_INFO_VIEW.DEVICE_ID;
+
+CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS
+SELECT
+DM_DEVICE.ID AS DEVICE_ID,
+DM_DEVICE.DEVICE_IDENTIFICATION,
+DM_DEVICE_DETAIL.DEVICE_MODEL,
+DM_DEVICE_DETAIL.VENDOR,
+DM_DEVICE_DETAIL.OS_VERSION,
+DM_ENROLMENT.OWNERSHIP,
+DM_ENROLMENT.OWNER,
+DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
+DM_POLICY_COMPLIANCE_STATUS.POLICY_ID,
+DM_DEVICE_TYPE.NAME AS PLATFORM,
+DM_POLICY_COMPLIANCE_FEATURES.FEATURE_CODE,
+DM_POLICY_COMPLIANCE_FEATURES.STATUS AS IS_COMPLAINT,
+DM_DEVICE.TENANT_ID
+FROM
+DM_POLICY_COMPLIANCE_FEATURES, DM_POLICY_COMPLIANCE_STATUS, DM_ENROLMENT, DM_DEVICE, DM_DEVICE_TYPE, DM_DEVICE_DETAIL
+WHERE
+DM_POLICY_COMPLIANCE_FEATURES.COMPLIANCE_STATUS_ID = DM_POLICY_COMPLIANCE_STATUS.ID AND
+DM_POLICY_COMPLIANCE_STATUS.ENROLMENT_ID = DM_ENROLMENT.ID AND
+DM_POLICY_COMPLIANCE_STATUS.DEVICE_ID = DM_DEVICE.ID AND
+DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND
+DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
+ORDER BY TENANT_ID, DEVICE_ID;
+
+-- END OF DASHBOARD RELATED VIEWS --
\ No newline at end of file
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
index 9c122d0764..e8cb6f4f27 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
@@ -336,22 +336,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ON UPDATE NO ACTION
)ENGINE = InnoDB;
-
-CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
- ID INTEGER AUTO_INCREMENT NOT NULL,
- DEVICE_ID INTEGER NOT NULL,
- OWNER VARCHAR(50) NOT NULL,
- OWNERSHIP VARCHAR(45) DEFAULT NULL,
- STATUS VARCHAR(50) NULL,
- DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL,
- DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL,
- TENANT_ID INT NOT NULL,
- PRIMARY KEY (ID),
- CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
- DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-)ENGINE = InnoDB;
-
-
CREATE TABLE IF NOT EXISTS DM_APPLICATION (
ID INTEGER AUTO_INCREMENT NOT NULL,
NAME VARCHAR(150) NOT NULL,
@@ -454,9 +438,6 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
-- END NOTIFICATION TABLES --
-
-DROP TABLE IF EXISTS DM_DEVICE_INFO;
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,
@@ -472,10 +453,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
)
ENGINE = InnoDB;
-
-
-DROP TABLE IF EXISTS DM_DEVICE_LOCATION;
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,
@@ -498,8 +475,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
)
ENGINE = InnoDB;
-DROP TABLE IF EXISTS DM_DEVICE_DETAIL ;
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL,
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql
index 8c98587ffe..c49d530140 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql
@@ -764,13 +764,6 @@ WHEN (NEW.ID IS NULL)
END;
/
-BEGIN
- EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_LOCATION';
- EXCEPTION
- WHEN OTHERS THEN NULL;
-END;
-/
-
CREATE TABLE DM_DEVICE_LOCATION (
ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NULL,
@@ -802,13 +795,6 @@ WHEN (NEW.ID IS NULL)
END;
/
-BEGIN
- EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_DETAIL';
- EXCEPTION
- WHEN OTHERS THEN NULL;
-END;
-/
-
CREATE TABLE DM_DEVICE_DETAIL (
ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NOT NULL,
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
index 52083e9d8c..828eca58cb 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
@@ -6,6 +6,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
UNIQUE(NAME)
);
+CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME);
+
CREATE TABLE IF NOT EXISTS DM_DEVICE (
ID BIGSERIAL NOT NULL PRIMARY KEY,
DESCRIPTION TEXT DEFAULT NULL,
@@ -18,6 +20,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID);
+
CREATE TABLE IF NOT EXISTS DM_OPERATION (
ID BIGSERIAL NOT NULL PRIMARY KEY,
TYPE VARCHAR(50) NOT NULL,
@@ -73,6 +77,9 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID);
+CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID);
+
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
ID BIGSERIAL NOT NULL PRIMARY KEY,
ENROLMENT_ID INTEGER NOT NULL,
@@ -86,6 +93,10 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
+CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
+CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
+
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
ID BIGSERIAL NOT NULL PRIMARY KEY,
ENROLMENT_ID INTEGER NOT NULL,
@@ -98,6 +109,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
+CREATE INDEX IDX_ENID_OPID ON DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID, ENROLMENT_ID);
-- POLICY RELATED TABLES ---
CREATE TABLE IF NOT EXISTS DM_PROFILE (