|
|
@ -22,6 +22,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
|
|
|
|
SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
|
|
|
|
SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
|
|
|
|
CERTIFICATE BLOB DEFAULT NULL,
|
|
|
|
CERTIFICATE BLOB DEFAULT NULL,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
|
|
|
USERNAME VARCHAR(500) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
@ -31,6 +32,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
DEVICE_TYPE_ID INT(11) DEFAULT NULL,
|
|
|
|
DEVICE_TYPE_ID INT(11) DEFAULT NULL,
|
|
|
|
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
|
|
|
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
|
|
|
|
|
|
|
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
|
|
|
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
|
|
@ -111,6 +113,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
STATUS VARCHAR(50) NULL,
|
|
|
|
STATUS VARCHAR(50) NULL,
|
|
|
|
|
|
|
|
CREATED_TIMESTAMP INT NOT NULL,
|
|
|
|
|
|
|
|
UPDATED_TIMESTAMP INT NOT NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
@ -123,6 +127,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
|
|
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
|
|
|
|
|
|
|
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
@ -502,17 +507,20 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
FOREIGN KEY (POLICY_ID , DEVICE_GROUP_ID)
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
REFERENCES DM_POLICY (ID , ID)
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
|
|
|
|
|
|
|
|
CREATE VIEW DEVICES_VIEW_1 AS
|
|
|
|
-- DASHBOARD RELATED VIEWS --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE VIEW POLICY_COMPLIANCE_INFO AS
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
DEVICE_INFO.DEVICE_ID,
|
|
|
|
DEVICE_INFO.DEVICE_ID,
|
|
|
|
|
|
|
|
DEVICE_INFO.DEVICE_IDENTIFICATION,
|
|
|
|
DEVICE_INFO.PLATFORM,
|
|
|
|
DEVICE_INFO.PLATFORM,
|
|
|
|
DEVICE_INFO.OWNERSHIP,
|
|
|
|
DEVICE_INFO.OWNERSHIP,
|
|
|
|
DEVICE_INFO.CONNECTIVITY_STATUS,
|
|
|
|
DEVICE_INFO.CONNECTIVITY_STATUS,
|
|
|
@ -522,10 +530,11 @@ DEVICE_INFO.TENANT_ID
|
|
|
|
FROM
|
|
|
|
FROM
|
|
|
|
(SELECT
|
|
|
|
(SELECT
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
|
|
|
|
DM_DEVICE.DEVICE_IDENTIFICATION,
|
|
|
|
DM_DEVICE_TYPE.NAME AS PLATFORM,
|
|
|
|
DM_DEVICE_TYPE.NAME AS PLATFORM,
|
|
|
|
DM_ENROLMENT.OWNERSHIP AS OWNERSHIP,
|
|
|
|
DM_ENROLMENT.OWNERSHIP,
|
|
|
|
DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
|
|
|
|
DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
|
|
|
|
DM_DEVICE.TENANT_ID AS TENANT_ID
|
|
|
|
DM_DEVICE.TENANT_ID
|
|
|
|
FROM DM_DEVICE, DM_DEVICE_TYPE, DM_ENROLMENT
|
|
|
|
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) DEVICE_INFO
|
|
|
|
WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) DEVICE_INFO
|
|
|
|
LEFT JOIN
|
|
|
|
LEFT JOIN
|
|
|
@ -533,7 +542,33 @@ LEFT JOIN
|
|
|
|
DEVICE_ID,
|
|
|
|
DEVICE_ID,
|
|
|
|
POLICY_ID,
|
|
|
|
POLICY_ID,
|
|
|
|
STATUS AS IS_COMPLIANT
|
|
|
|
STATUS AS IS_COMPLIANT
|
|
|
|
FROM
|
|
|
|
FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
|
|
|
|
DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
|
|
|
|
|
|
|
|
ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
|
|
|
|
ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
|
|
|
|
ORDER BY DEVICE_INFO.DEVICE_ID;
|
|
|
|
ORDER BY DEVICE_INFO.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 --
|
|
|
|