|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
|
|
|
|
|
(
|
|
|
|
|
ID INT AUTO_INCREMENT NOT NULL,
|
|
|
|
|
NAME VARCHAR(300) NULL DEFAULT NULL,
|
|
|
|
|
DEVICE_TYPE_META VARCHAR(20000) NULL DEFAULT NULL,
|
|
|
|
@ -8,7 +9,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER auto_increment NOT NULL,
|
|
|
|
|
SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
|
|
|
|
|
CERTIFICATE BLOB DEFAULT NULL,
|
|
|
|
@ -17,7 +19,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GROUP (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GROUP
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
STATUS VARCHAR(50) DEFAULT NULL,
|
|
|
|
@ -28,7 +31,8 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
|
ROLE VARCHAR(45) DEFAULT NULL,
|
|
|
|
@ -38,7 +42,8 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER auto_increment NOT NULL,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
|
NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
@ -52,7 +57,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
|
CONSTRAINT uk_DM_DEVICE UNIQUE (NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES
|
|
|
|
|
(
|
|
|
|
|
DEVICE_TYPE_NAME VARCHAR(300) NOT NULL,
|
|
|
|
|
DEVICE_IDENTIFICATION VARCHAR(300) NOT NULL,
|
|
|
|
|
PROPERTY_NAME VARCHAR(100) DEFAULT 0,
|
|
|
|
@ -61,7 +67,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES (
|
|
|
|
|
PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES
|
|
|
|
|
(
|
|
|
|
|
GROUP_ID INTEGER NOT NULL,
|
|
|
|
|
PROPERTY_NAME VARCHAR(100) DEFAULT 0,
|
|
|
|
|
PROPERTY_VALUE VARCHAR(100) DEFAULT NULL,
|
|
|
|
@ -69,7 +76,8 @@ CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES (
|
|
|
|
|
PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
@ -81,7 +89,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OPERATION
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
TYPE VARCHAR(50) NOT NULL,
|
|
|
|
|
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
@ -93,7 +102,8 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OWNER VARCHAR(255) NOT NULL,
|
|
|
|
@ -109,7 +119,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
CONSTRAINT uk_dm_device_enrolment UNIQUE (DEVICE_ID, OWNER, OWNERSHIP, TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
@ -131,7 +142,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
@ -148,7 +160,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
DM_ENROLMENT_OP_MAPPING (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_OPERATION_RESPONSE_LARGE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE_LARGE
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_RESPONSE LONGBLOB DEFAULT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
@ -165,7 +178,8 @@ CREATE TABLE DM_DEVICE_OPERATION_RESPONSE_LARGE (
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES --
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
PROFILE_NAME VARCHAR(45) NOT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
@ -175,7 +189,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
NAME VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
DESCRIPTION VARCHAR(1000) NULL,
|
|
|
|
@ -196,7 +211,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_ID INT(11) NOT NULL,
|
|
|
|
|
ENROLMENT_ID INT(11) NOT NULL,
|
|
|
|
@ -215,7 +231,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL,
|
|
|
|
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
|
|
|
|
POLICY_ID INT(11) NOT NULL,
|
|
|
|
@ -227,7 +244,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
PROFILE_ID INT(11) NOT NULL,
|
|
|
|
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
|
|
|
@ -242,7 +260,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
ACTION_TYPE VARCHAR(45) NOT NULL,
|
|
|
|
|
CORRECTIVE_POLICY_ID INT(11) DEFAULT NULL,
|
|
|
|
@ -257,7 +276,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
|
ROLE_NAME VARCHAR(45) NOT NULL,
|
|
|
|
|
POLICY_ID INT(11) NOT NULL,
|
|
|
|
@ -269,7 +289,8 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_USER_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
|
USERNAME VARCHAR(45) NOT NULL,
|
|
|
|
@ -281,7 +302,8 @@ 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,
|
|
|
|
@ -300,14 +322,16 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_CRITERIA (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_CRITERIA
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
NAME VARCHAR(50) NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
CRITERIA_ID INT NOT NULL,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
@ -324,7 +348,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
POLICY_CRITERION_ID INT NOT NULL,
|
|
|
|
|
PROP_KEY VARCHAR(45) NULL,
|
|
|
|
@ -338,7 +363,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_ID INT NOT NULL,
|
|
|
|
|
ENROLMENT_ID INT(11) NOT NULL,
|
|
|
|
@ -352,7 +378,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
|
|
|
@ -360,7 +387,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
COMPLIANCE_STATUS_ID INT NOT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
@ -374,7 +402,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_APPLICATION
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
NAME VARCHAR(150) NOT NULL,
|
|
|
|
|
APP_IDENTIFIER VARCHAR(150) NOT NULL,
|
|
|
|
@ -406,7 +435,8 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
|
|
|
|
|
|
-- NOTIFICATION TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION
|
|
|
|
|
(
|
|
|
|
|
NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NULL,
|
|
|
|
@ -420,7 +450,8 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
|
);
|
|
|
|
|
-- NOTIFICATION TABLE END --
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
@ -441,7 +472,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO (DEVICE_ID, ENROLMENT_ID, KEY_FIELD);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION
|
|
|
|
|
(
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
@ -473,7 +505,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|
|
|
|
);
|
|
|
|
|
CREATE INDEX DM_DEVICE_LOCATION_GEO_hashx ON DM_DEVICE_LOCATION (GEO_HASH ASC);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_ID INT NOT NULL,
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
@ -528,7 +561,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_GROUP_ID INT NOT NULL,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
@ -548,7 +582,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_PLATFORM (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_PLATFORM
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_TYPE_ID INT NULL DEFAULT 0,
|
|
|
|
|
VERSION_NAME VARCHAR(100) NULL,
|
|
|
|
@ -565,7 +600,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_PLATFORM (
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- METADATA TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_METADATA (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_METADATA
|
|
|
|
|
(
|
|
|
|
|
METADATA_ID INT AUTO_INCREMENT NOT NULL,
|
|
|
|
|
DATA_TYPE VARCHAR(16) NOT NULL,
|
|
|
|
|
METADATA_KEY VARCHAR(128) NOT NULL,
|
|
|
|
@ -577,7 +613,8 @@ CREATE TABLE IF NOT EXISTS DM_METADATA (
|
|
|
|
|
-- END OF METADATA TABLE --
|
|
|
|
|
|
|
|
|
|
-- DM_OTP_DATA TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OTP_DATA (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OTP_DATA
|
|
|
|
|
(
|
|
|
|
|
ID INT AUTO_INCREMENT NOT NULL,
|
|
|
|
|
OTP_TOKEN VARCHAR(100) NOT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
@ -594,8 +631,7 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA (
|
|
|
|
|
|
|
|
|
|
-- DASHBOARD RELATED VIEWS --
|
|
|
|
|
CREATE VIEW POLICY_COMPLIANCE_INFO AS
|
|
|
|
|
SELECT
|
|
|
|
|
DEVICE_INFO.DEVICE_ID,
|
|
|
|
|
SELECT DEVICE_INFO.DEVICE_ID,
|
|
|
|
|
DEVICE_INFO.DEVICE_IDENTIFICATION,
|
|
|
|
|
DEVICE_INFO.PLATFORM,
|
|
|
|
|
DEVICE_INFO.OWNERSHIP,
|
|
|
|
@ -603,19 +639,19 @@ DEVICE_INFO.CONNECTIVITY_STATUS,
|
|
|
|
|
IFNULL(DEVICE_WITH_POLICY_INFO.POLICY_ID, -1) AS POLICY_ID,
|
|
|
|
|
IFNULL(DEVICE_WITH_POLICY_INFO.IS_COMPLIANT, -1) AS IS_COMPLIANT,
|
|
|
|
|
DEVICE_INFO.TENANT_ID
|
|
|
|
|
FROM
|
|
|
|
|
(SELECT
|
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
|
FROM (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) DEVICE_INFO
|
|
|
|
|
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
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT
|
|
|
|
|
DEVICE_ID,
|
|
|
|
|
(SELECT DEVICE_ID,
|
|
|
|
|
POLICY_ID,
|
|
|
|
|
STATUS AS IS_COMPLIANT
|
|
|
|
|
FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
|
|
|
|
@ -623,8 +659,7 @@ ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
|
|
|
|
|
ORDER BY DEVICE_INFO.DEVICE_ID;
|
|
|
|
|
|
|
|
|
|
CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS
|
|
|
|
|
SELECT
|
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
|
SELECT DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
|
DM_DEVICE.DEVICE_IDENTIFICATION,
|
|
|
|
|
DM_DEVICE_DETAIL.DEVICE_MODEL,
|
|
|
|
|
DM_DEVICE_DETAIL.VENDOR,
|
|
|
|
@ -637,21 +672,25 @@ 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
|
|
|
|
|
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 --
|
|
|
|
|
|
|
|
|
|
-- DM_GEOFENCE TABLE--
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
FENCE_NAME VARCHAR(255) NOT NULL,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
@ -669,7 +708,8 @@ CREATE TABLE IF NOT EXISTS DM_GEOFENCE (
|
|
|
|
|
-- END OF DM_GEOFENCE TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_GEOFENCE_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE_GROUP_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE_GROUP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
FENCE_ID INT NOT NULL,
|
|
|
|
|
GROUP_ID INT NOT NULL,
|
|
|
|
@ -684,7 +724,8 @@ CREATE TABLE IF NOT EXISTS DM_GEOFENCE_GROUP_MAPPING (
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_EVENT TABLE --
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
EVENT_SOURCE VARCHAR(100) NOT NULL,
|
|
|
|
|
EVENT_LOGIC VARCHAR(100) NOT NULL,
|
|
|
|
@ -697,7 +738,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT (
|
|
|
|
|
-- END OF DM_DEVICE_EVENT TABLE --
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_EVENT_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT_GROUP_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT_GROUP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
EVENT_ID INT NOT NULL,
|
|
|
|
|
GROUP_ID INT NOT NULL,
|
|
|
|
@ -711,7 +753,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT_GROUP_MAPPING (
|
|
|
|
|
-- END OF DM_DEVICE_EVENT_GROUP_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_GEOFENCE_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE_EVENT_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE_EVENT_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
FENCE_ID INT NOT NULL,
|
|
|
|
|
EVENT_ID INT NOT NULL,
|
|
|
|
@ -725,7 +768,8 @@ CREATE TABLE IF NOT EXISTS DM_GEOFENCE_EVENT_MAPPING (
|
|
|
|
|
-- END OF DM_GEOFENCE_GROUP_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_EXT_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_GROUP_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_GROUP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
TRACCAR_GROUP_ID INT DEFAULT 0,
|
|
|
|
|
GROUP_ID INT NOT NULL,
|
|
|
|
@ -736,7 +780,8 @@ CREATE TABLE IF NOT EXISTS DM_EXT_GROUP_MAPPING (
|
|
|
|
|
-- END OF DM_EXT_GROUP_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- END OF DM_EXT_DEVICE_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_DEVICE_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_DEVICE_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
TRACCAR_DEVICE_ID INT DEFAULT 0,
|
|
|
|
|
DEVICE_ID INT NOT NULL,
|
|
|
|
@ -765,14 +810,16 @@ CREATE TABLE IF NOT EXISTS DM_EXT_DEVICE_MAPPING (
|
|
|
|
|
-- END OF DM_EXT_DEVICE_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- END OF DM_EXT_PERMISSION_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_PERMISSION_MAPPING (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_EXT_PERMISSION_MAPPING
|
|
|
|
|
(
|
|
|
|
|
TRACCAR_DEVICE_ID INT DEFAULT 0,
|
|
|
|
|
TRACCAR_USER_ID INT DEFAULT 0
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_EXT_PERMISSION_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- DYNAMIC TASK TABLES--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DYNAMIC_TASK (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DYNAMIC_TASK
|
|
|
|
|
(
|
|
|
|
|
DYNAMIC_TASK_ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
NAME VARCHAR(300) DEFAULT NULL,
|
|
|
|
|
CRON VARCHAR(8000) DEFAULT NULL,
|
|
|
|
@ -782,7 +829,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK (
|
|
|
|
|
PRIMARY KEY (DYNAMIC_TASK_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES
|
|
|
|
|
(
|
|
|
|
|
DYNAMIC_TASK_ID INTEGER NOT NULL,
|
|
|
|
|
PROPERTY_NAME VARCHAR(100) DEFAULT 0,
|
|
|
|
|
PROPERTY_VALUE VARCHAR(100) DEFAULT NULL,
|
|
|
|
@ -794,7 +842,8 @@ CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES (
|
|
|
|
|
-- END OF DYNAMIC TASK TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_SUB_TYPE TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE
|
|
|
|
|
(
|
|
|
|
|
TENANT_ID INT DEFAULT 0,
|
|
|
|
|
SUB_TYPE_ID VARCHAR(45) NOT NULL,
|
|
|
|
|
DEVICE_TYPE VARCHAR(25) NOT NULL,
|
|
|
|
@ -805,8 +854,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_SUB_TYPE (
|
|
|
|
|
-- END OF DM_DEVICE_SUB_TYPE TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_ORGANIZATION TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_ORGANIZATION (
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_ORGANIZATION
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
DEVICE_ID INT(11) NOT NULL,
|
|
|
|
|
PARENT_DEVICE_ID INT(11) DEFAULT NULL,
|
|
|
|
|
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
|