|
|
|
@ -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 --
|