|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE_TYPE;
|
|
|
|
|
CREATE TABLE DM_DEVICE_TYPE (
|
|
|
|
|
ID BIGSERIAL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(300) DEFAULT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE;
|
|
|
|
|
CREATE TABLE DM_DEVICE (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
|
NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
@ -14,7 +16,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
|
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_OPERATION;
|
|
|
|
|
CREATE TABLE DM_OPERATION (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
TYPE VARCHAR(50) NOT NULL,
|
|
|
|
|
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
@ -22,7 +25,8 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
|
|
|
OPERATION_CODE VARCHAR(1000) NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_CONFIG_OPERATION;
|
|
|
|
|
CREATE TABLE DM_CONFIG_OPERATION (
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_CONFIG BYTEA DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
@ -30,7 +34,8 @@ CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_COMMAND_OPERATION;
|
|
|
|
|
CREATE TABLE DM_COMMAND_OPERATION (
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
@ -38,7 +43,8 @@ CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_OPERATION;
|
|
|
|
|
CREATE TABLE DM_POLICY_OPERATION (
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
|
ENABLED INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
OPERATION_DETAILS BYTEA DEFAULT NULL,
|
|
|
|
@ -47,7 +53,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_PROFILE_OPERATION;
|
|
|
|
|
CREATE TABLE DM_PROFILE_OPERATION (
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
|
ENABLED INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
OPERATION_DETAILS BYTEA DEFAULT NULL,
|
|
|
|
@ -56,7 +63,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
DROP TABLE IF EXISTS DM_ENROLMENT;
|
|
|
|
|
CREATE TABLE DM_ENROLMENT (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OWNER VARCHAR(50) NOT NULL,
|
|
|
|
@ -69,7 +77,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING (
|
|
|
|
|
DROP TABLE IF EXISTS DM_ENROLMENT_OP_MAPPING;
|
|
|
|
|
CREATE TABLE DM_ENROLMENT_OP_MAPPING (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
@ -80,7 +89,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING (
|
|
|
|
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE_OPERATION_RESPONSE;
|
|
|
|
|
CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
@ -93,7 +103,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES ---
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|
|
|
|
DROP TABLE IF EXISTS DM_PROFILE;
|
|
|
|
|
CREATE TABLE DM_PROFILE (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
PROFILE_NAME VARCHAR(45) NOT NULL ,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL ,
|
|
|
|
@ -107,8 +118,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY;
|
|
|
|
|
CREATE TABLE DM_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(45) DEFAULT NULL ,
|
|
|
|
|
DESCRIPTION VARCHAR(1000) NULL,
|
|
|
|
@ -126,7 +137,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE_POLICY;
|
|
|
|
|
CREATE TABLE DM_DEVICE_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL ,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
@ -144,7 +156,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE_TYPE_POLICY;
|
|
|
|
|
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
|
DEVICE_TYPE_ID INTEGER NOT NULL ,
|
|
|
|
|
POLICY_ID INTEGER NOT NULL ,
|
|
|
|
@ -161,7 +174,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|
|
|
|
DROP TABLE IF EXISTS DM_PROFILE_FEATURES;
|
|
|
|
|
CREATE TABLE DM_PROFILE_FEATURES (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
PROFILE_ID INTEGER NOT NULL,
|
|
|
|
|
FEATURE_CODE VARCHAR(30) NOT NULL,
|
|
|
|
@ -175,7 +189,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
|
|
|
|
DROP TABLE IF EXISTS DM_ROLE_POLICY;
|
|
|
|
|
CREATE TABLE DM_ROLE_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
ROLE_NAME VARCHAR(45) NOT NULL ,
|
|
|
|
|
POLICY_ID INTEGER NOT NULL,
|
|
|
|
@ -186,7 +201,8 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
|
|
|
|
|
DROP TABLE IF EXISTS DM_USER_POLICY;
|
|
|
|
|
CREATE TABLE DM_USER_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
POLICY_ID INT NOT NULL ,
|
|
|
|
|
USERNAME VARCHAR(45) NOT NULL,
|
|
|
|
@ -197,7 +213,8 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
|
|
|
|
DROP TABLE IF EXISTS DM_DEVICE_POLICY_APPLIED;
|
|
|
|
|
CREATE TABLE DM_DEVICE_POLICY_APPLIED (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL ,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
@ -220,13 +237,15 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_CRITERIA (
|
|
|
|
|
DROP TABLE IF EXISTS DM_CRITERIA;
|
|
|
|
|
CREATE TABLE DM_CRITERIA (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
NAME VARCHAR(50) NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_CRITERIA;
|
|
|
|
|
CREATE TABLE DM_POLICY_CRITERIA (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
CRITERIA_ID INT NOT NULL,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
@ -242,7 +261,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_CRITERIA_PROPERTIES;
|
|
|
|
|
CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
POLICY_CRITERION_ID INT NOT NULL,
|
|
|
|
|
PROP_KEY VARCHAR(45) NULL,
|
|
|
|
@ -256,8 +276,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON COLUMN DM_POLICY_CRITERIA_PROPERTIES.CONTENT IS 'This is used to ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_COMPLIANCE_STATUS;
|
|
|
|
|
CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
@ -276,16 +296,16 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
);
|
|
|
|
|
CREATE UNIQUE INDEX DEVICE_ID_UNIQUE ON DM_POLICY_COMPLIANCE_STATUS (DEVICE_ID ASC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_CHANGE_MGT;
|
|
|
|
|
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
POLICY_ID INTEGER NOT NULL,
|
|
|
|
|
DEVICE_TYPE_ID INTEGER NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
DROP TABLE IF EXISTS DM_POLICY_COMPLIANCE_FEATURES;
|
|
|
|
|
CREATE TABLE DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
COMPLIANCE_STATUS_ID INTEGER NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
@ -298,8 +318,8 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
DROP TABLE IF EXISTS DM_ENROLMENT;
|
|
|
|
|
CREATE TABLE DM_ENROLMENT (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OWNER VARCHAR(50) NOT NULL,
|
|
|
|
@ -312,8 +332,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_APPLICATION;
|
|
|
|
|
CREATE TABLE DM_APPLICATION (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(50) NOT NULL,
|
|
|
|
|
APP_IDENTIFIER VARCHAR(150) NOT NULL,
|
|
|
|
@ -330,7 +350,8 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
|
|
|
|
|
|
-- NOTIFICATION TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
|
DROP TABLE IF EXISTS DM_NOTIFICATION;
|
|
|
|
|
CREATE TABLE DM_NOTIFICATION (
|
|
|
|
|
NOTIFICATION_ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OPERATION_ID INTEGER NOT NULL,
|
|
|
|
|