|
|
@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
OWNER VARCHAR(45) DEFAULT NULL,
|
|
|
|
OWNER VARCHAR(255) DEFAULT NULL,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -50,6 +50,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES (
|
|
|
|
PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID)
|
|
|
|
PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES (
|
|
|
|
|
|
|
|
GROUP_ID INTEGER NOT NULL,
|
|
|
|
|
|
|
|
PROPERTY_NAME VARCHAR(100) DEFAULT 0,
|
|
|
|
|
|
|
|
PROPERTY_VALUE VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
|
|
|
TENANT_ID VARCHAR(100),
|
|
|
|
|
|
|
|
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,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
@ -109,7 +117,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
OWNER VARCHAR(50) NOT NULL,
|
|
|
|
OWNER VARCHAR(255) NOT NULL,
|
|
|
|
OWNERSHIP VARCHAR(45) DEFAULT NULL,
|
|
|
|
OWNERSHIP VARCHAR(45) DEFAULT NULL,
|
|
|
|
STATUS VARCHAR(50) NULL,
|
|
|
|
STATUS VARCHAR(50) NULL,
|
|
|
|
DATE_OF_ENROLMENT TIMESTAMP DEFAULT NULL,
|
|
|
|
DATE_OF_ENROLMENT TIMESTAMP DEFAULT NULL,
|
|
|
@ -301,7 +309,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
POLICY_CRITERION_ID INT NOT NULL,
|
|
|
|
POLICY_CRITERION_ID INT NOT NULL,
|
|
|
|
PROP_KEY VARCHAR(45) NULL,
|
|
|
|
PROP_KEY VARCHAR(45) NULL,
|
|
|
|
PROP_VALUE VARCHAR(100) NULL,
|
|
|
|
PROP_VALUE VARCHAR(100) NULL,
|
|
|
|
CONTENT BLOB NULL COMMENT 'This is used to ',
|
|
|
|
CONTENT BLOB NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
|
|
|
|
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
|
|
|
|
FOREIGN KEY (POLICY_CRITERION_ID)
|
|
|
|
FOREIGN KEY (POLICY_CRITERION_ID)
|
|
|
@ -366,13 +374,28 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
APPLICATION_ID INTEGER NOT NULL,
|
|
|
|
APPLICATION_ID INTEGER NOT NULL,
|
|
|
|
|
|
|
|
APP_PROPERTIES BLOB NULL,
|
|
|
|
|
|
|
|
MEMORY_USAGE INTEGER(10) NULL,
|
|
|
|
|
|
|
|
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
CONSTRAINT fk_dm_device
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT fk_dm_application
|
|
|
|
|
|
|
|
FOREIGN KEY (APPLICATION_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_APPLICATION (ID)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT FK_DM_APP_MAP_DM_ENROL
|
|
|
|
|
|
|
|
FOREIGN KEY (ENROLMENT_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_ENROLMENT (ID)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
@ -381,34 +404,40 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
OPERATION_ID INTEGER NULL,
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
STATUS VARCHAR(10) NULL,
|
|
|
|
STATUS VARCHAR(10) NULL,
|
|
|
|
DESCRIPTION VARCHAR(1000) NULL,
|
|
|
|
DESCRIPTION VARCHAR(1000) NULL,
|
|
|
|
|
|
|
|
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
PRIMARY KEY (NOTIFICATION_ID),
|
|
|
|
PRIMARY KEY (NOTIFICATION_ID),
|
|
|
|
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
-- NOTIFICATION TABLE END --
|
|
|
|
-- 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,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
KEY_FIELD VARCHAR(45) NULL,
|
|
|
|
KEY_FIELD VARCHAR(45) NULL,
|
|
|
|
VALUE_FIELD VARCHAR(100) NULL,
|
|
|
|
VALUE_FIELD VARCHAR(1000) NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT DM_DEVICE_INFO_DEVICE
|
|
|
|
CONSTRAINT DM_DEVICE_INFO_DEVICE
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT DM_DEVICE_INFO_DEVICE_ENROLLMENT
|
|
|
|
|
|
|
|
FOREIGN KEY (ENROLMENT_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_ENROLMENT (ID)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
DEVICE_ID INT NULL,
|
|
|
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
LATITUDE DOUBLE NULL,
|
|
|
|
LATITUDE DOUBLE NULL,
|
|
|
|
LONGITUDE DOUBLE NULL,
|
|
|
|
LONGITUDE DOUBLE NULL,
|
|
|
|
STREET1 VARCHAR(255) NULL,
|
|
|
|
STREET1 VARCHAR(255) NULL,
|
|
|
@ -417,18 +446,26 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|
|
|
ZIP VARCHAR(10) NULL,
|
|
|
|
ZIP VARCHAR(10) NULL,
|
|
|
|
STATE VARCHAR(45) NULL,
|
|
|
|
STATE VARCHAR(45) NULL,
|
|
|
|
COUNTRY VARCHAR(45) NULL,
|
|
|
|
COUNTRY VARCHAR(45) NULL,
|
|
|
|
|
|
|
|
GEO_HASH VARCHAR(45) NULL,
|
|
|
|
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
|
|
|
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
|
|
|
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT DM_DEVICE_LOCATION_DM_ENROLLMENT
|
|
|
|
|
|
|
|
FOREIGN KEY (ENROLMENT_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_ENROLMENT (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
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,
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
DEVICE_ID INT NOT NULL,
|
|
|
|
DEVICE_ID INT NOT NULL,
|
|
|
|
|
|
|
|
ENROLMENT_ID INT NOT NULL,
|
|
|
|
DEVICE_MODEL VARCHAR(45) NULL,
|
|
|
|
DEVICE_MODEL VARCHAR(45) NULL,
|
|
|
|
VENDOR VARCHAR(45) NULL,
|
|
|
|
VENDOR VARCHAR(45) NULL,
|
|
|
|
OS_VERSION VARCHAR(45) NULL,
|
|
|
|
OS_VERSION VARCHAR(45) NULL,
|
|
|
@ -450,6 +487,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT FK_DM_ENROLMENT_DEVICE_DETAILS
|
|
|
|
|
|
|
|
FOREIGN KEY (ENROLMENT_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_ENROLMENT (ID)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|