|
|
|
@ -1,14 +1,17 @@
|
|
|
|
|
CREATE TABLE DM_DEVICE_TYPE (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
NAME VARCHAR2(300) DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CONSTRAINT PK_DM_DEVICE_TYPE PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_TYPE_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_TYPE_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_TYPE_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_TYPE FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_TYPE
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_TYPE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -22,16 +25,19 @@ CREATE TABLE DM_DEVICE (
|
|
|
|
|
DEVICE_TYPE_ID NUMBER(10) DEFAULT NULL,
|
|
|
|
|
DEVICE_IDENTIFICATION VARCHAR2(300) DEFAULT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) DEFAULT 0,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_DEVICE PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
|
|
|
|
REFERENCES DM_DEVICE_TYPE (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -44,14 +50,17 @@ CREATE TABLE DM_OPERATION (
|
|
|
|
|
CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL,
|
|
|
|
|
RECEIVED_TIMESTAMP TIMESTAMP(0) NULL,
|
|
|
|
|
OPERATION_CODE VARCHAR2(1000) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_OPERATION_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_OPERATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_OPERATION_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_OPERATION FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_OPERATION
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_OPERATION_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -61,37 +70,37 @@ END;
|
|
|
|
|
CREATE TABLE DM_CONFIG_OPERATION (
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
OPERATION_CONFIG BLOB DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT PK_DM_CONFIG_OPERATION PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
CREATE TABLE DM_COMMAND_OPERATION (
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
ENABLED CHAR(1) DEFAULT FALSE NOT NULL,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
|
|
|
|
|
CONSTRAINT PK_DM_COMMAND_OPERATION PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
CREATE TABLE DM_POLICY_OPERATION (
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
|
|
|
|
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_OPERATION PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT fk_dm_operation_policy FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
CREATE TABLE DM_PROFILE_OPERATION (
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
|
|
|
|
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT PK_DM_PROFILE_OPERATION PRIMARY KEY (OPERATION_ID),
|
|
|
|
|
CONSTRAINT fk_dm_operation_profile FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
CREATE TABLE DM_ENROLMENT (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
@ -101,42 +110,48 @@ CREATE TABLE DM_ENROLMENT (
|
|
|
|
|
DATE_OF_ENROLMENT TIMESTAMP(0) DEFAULT NULL,
|
|
|
|
|
DATE_OF_LAST_UPDATE TIMESTAMP(0) DEFAULT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_ENROLMENT PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_ENROLMENT_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_ENROLMENT_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_ENROLMENT_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_ENROLMENT FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_ENROLMENT
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_ENROLMENT_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_ENROLMENT_OP_MAPPING (
|
|
|
|
|
CREATE TABLE DM_ENROLMENT_op_map (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
ENROLMENT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
STATUS VARCHAR2(50) NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
|
CONSTRAINT fk_dm_device_op_map_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
|
DM_ENROLMENT (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
CONSTRAINT fk_dm_device_op_map_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_ENROLMENT_OP_MAPPING_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_ENROLMENT_OP_MAPPING_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_ENROLMENT_OP_MAPPING FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_ENROLMENT_op_map_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_ENROLMENT_op_map_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_ENROLMENT_op_map
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_ENROLMENT_OP_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_ENROLMENT_op_map_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
@ -145,29 +160,28 @@ CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
OPERATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_operation_response_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
CONSTRAINT PK_DM_DEVICE_OP_RESPONSE PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_op_res_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
CONSTRAINT fk_dm_device_op_res_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_OPERATION_RESPONSE_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_OPERATION_RESPONSE_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_OPERATION_RESPONSE FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_OP_RESPONSE_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_OP_RESPONSE_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_OPERATION_RESPONSE
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_OPERATION_RESPONSE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_DEVICE_OP_RESPONSE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_PROFILE (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
PROFILE_NAME VARCHAR2(45) NOT NULL ,
|
|
|
|
@ -175,17 +189,20 @@ CREATE TABLE DM_PROFILE (
|
|
|
|
|
DEVICE_TYPE_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
CREATED_TIME TIMESTAMP(0) NOT NULL ,
|
|
|
|
|
UPDATED_TIME TIMESTAMP(0) NOT NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT PK_DM_PROFILE PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT DM_PROFILE_DEVICE_TYPE
|
|
|
|
|
FOREIGN KEY (DEVICE_TYPE_ID )
|
|
|
|
|
REFERENCES DM_DEVICE_TYPE (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_PROFILE_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_PROFILE_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_PROFILE_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_PROFILE FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_PROFILE
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_PROFILE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -193,9 +210,6 @@ END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_POLICY (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
NAME VARCHAR2(45) DEFAULT NULL ,
|
|
|
|
@ -207,17 +221,20 @@ CREATE TABLE DM_POLICY (
|
|
|
|
|
PRIORITY NUMBER(10) NOT NULL,
|
|
|
|
|
ACTIVE NUMBER(10) NOT NULL,
|
|
|
|
|
UPDATED NUMBER(10) NULL,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT PK_DM_PROFILE_DM_POLICY PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY
|
|
|
|
|
FOREIGN KEY (PROFILE_ID )
|
|
|
|
|
REFERENCES DM_PROFILE (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -225,29 +242,29 @@ END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_POLICY (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
ENROLMENT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE BLOB NOT NULL,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT PK_POLICY_DEVICE_POLICY PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_POLICY_DEVICE_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID )
|
|
|
|
|
REFERENCES DM_POLICY (ID )
|
|
|
|
|
,
|
|
|
|
|
REFERENCES DM_POLICY (ID ),
|
|
|
|
|
CONSTRAINT FK_DEVICE_DEVICE_POLICY
|
|
|
|
|
FOREIGN KEY (DEVICE_ID )
|
|
|
|
|
REFERENCES DM_DEVICE (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_POLICY_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_POLICY_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_POLICY FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_POLICY
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_POLICY_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -255,24 +272,19 @@ END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_TYPE_POLICY (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
DEVICE_TYPE_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
|
|
|
|
CONSTRAINT PK_DEV_TYPE_POLICY PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DEV_TYPE_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID )
|
|
|
|
|
REFERENCES DM_POLICY (ID )
|
|
|
|
|
,
|
|
|
|
|
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
|
|
|
|
|
REFERENCES DM_POLICY (ID ),
|
|
|
|
|
CONSTRAINT FK_DEV_TYPE_POLICY_DEV_TYPE
|
|
|
|
|
FOREIGN KEY (DEVICE_TYPE_ID )
|
|
|
|
|
REFERENCES DM_DEVICE_TYPE (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_PROFILE_FEATURES (
|
|
|
|
@ -282,41 +294,45 @@ CREATE TABLE DM_PROFILE_FEATURES (
|
|
|
|
|
DEVICE_TYPE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
CONTENT BLOB DEFAULT NULL NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
|
|
|
|
CONSTRAINT PK_DM_PROF_DM_POLICY_FEATURES PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_DM_PROF_DM_POLICY_FEATURES
|
|
|
|
|
FOREIGN KEY (PROFILE_ID)
|
|
|
|
|
REFERENCES DM_PROFILE (ID)
|
|
|
|
|
);
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_PROFILE_FEATURES_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_PROFILE_FEATURES_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_PROFILE_FEATURES_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_PROFILE_FEATURES FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_PROFILE_FEATURES
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_PROFILE_FEATURES_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_ROLE_POLICY (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
ROLE_NAME VARCHAR2(45) NOT NULL ,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT PK_ROLE_POLICY_POLICY PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_ROLE_POLICY_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID )
|
|
|
|
|
REFERENCES DM_POLICY (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_ROLE_POLICY_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_ROLE_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_ROLE_POLICY_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_ROLE_POLICY FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_ROLE_POLICY
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_ROLE_POLICY_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -324,23 +340,24 @@ END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_USER_POLICY (
|
|
|
|
|
ID NUMBER(10) NOT NULL ,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL ,
|
|
|
|
|
USERNAME VARCHAR2(45) NOT NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT DM_POLICY_USER_POLICY
|
|
|
|
|
CONSTRAINT PK_DM_USER_POLICY PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DM_POLICY_USER_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID )
|
|
|
|
|
REFERENCES DM_POLICY (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_USER_POLICY_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_USER_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_USER_POLICY_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_USER_POLICY FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_USER_POLICY
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_USER_POLICY_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -359,64 +376,71 @@ END;
|
|
|
|
|
CREATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
|
UPDATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
|
APPLIED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
|
PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_DEV_APPLIED PRIMARY KEY (ID) ,
|
|
|
|
|
CONSTRAINT FK_DM_POLICY_DEV_APPLIED
|
|
|
|
|
FOREIGN KEY (DEVICE_ID )
|
|
|
|
|
REFERENCES DM_DEVICE (ID )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
REFERENCES DM_DEVICE (ID ),
|
|
|
|
|
CONSTRAINT FK_DM_POLICY_DEV_APPLY_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID )
|
|
|
|
|
REFERENCES DM_POLICY (ID )
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_POLICY_APPLIED_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_POLICY_APPLIED_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_POLICY_APPLIED FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_POLICY_APPLIED_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEV_POLICY_APPLIED_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_POLICY_APPLIED
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_POLICY_APPLIED_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_CRITERIA (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
NAME VARCHAR2(50) NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CONSTRAINT PK_DM_CRITERIA PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_CRITERIA_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_CRITERIA_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_CRITERIA_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_CRITERIA FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_CRITERIA
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_CRITERIA_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_POLICY_CRITERIA (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
CRITERIA_ID NUMBER(10) NOT NULL,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_CRITERIA PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_CRITERIA_POLICY_CRITERIA
|
|
|
|
|
FOREIGN KEY (CRITERIA_ID)
|
|
|
|
|
REFERENCES DM_CRITERIA (ID)
|
|
|
|
|
,
|
|
|
|
|
REFERENCES DM_CRITERIA (ID),
|
|
|
|
|
CONSTRAINT FK_POLICY_POLICY_CRITERIA
|
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CRITERIA_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CRITERIA_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_CRITERIA_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY_CRITERIA FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY_CRITERIA
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_CRITERIA_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
@ -429,21 +453,24 @@ CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
|
|
|
|
|
PROP_KEY VARCHAR2(45) NULL,
|
|
|
|
|
PROP_VALUE VARCHAR2(100) NULL,
|
|
|
|
|
CONTENT BLOB NULL ,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_CRITERIA_PROP PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_POLICY_CRITERIA_PROP
|
|
|
|
|
FOREIGN KEY (POLICY_CRITERION_ID)
|
|
|
|
|
REFERENCES DM_POLICY_CRITERIA (ID)
|
|
|
|
|
ON DELETE CASCADE
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CRITERIA_PROPERTIES_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_CRITERIA_PROPERTIES_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY_CRITERIA_PROPERTIES FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CRITERIA_PROP_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_CRITERIA_PROP_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY_CRITERIA_PROPERTIES
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_CRITERIA_PROPERTIES_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_POLICY_CRITERIA_PROP_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
@ -458,90 +485,72 @@ CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
LAST_REQUESTED_TIME TIMESTAMP(0) NULL,
|
|
|
|
|
LAST_FAILED_TIME TIMESTAMP(0) NULL,
|
|
|
|
|
ATTEMPTS NUMBER(10) NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_COMP_STATUS PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT DEVICE_ID_UNIQUE UNIQUE (DEVICE_ID),
|
|
|
|
|
CONSTRAINT FK_POLICY_COMPLIANCE_STATUS_POLICY
|
|
|
|
|
CONSTRAINT FK_POLICY_COMP_STATUS_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_COMPLIANCE_STATUS_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_COMPLIANCE_STATUS_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY_COMPLIANCE_STATUS FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_COMP_STATUS_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_COMP_STATUS_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY_COMPLIANCE_STATUS
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_COMPLIANCE_STATUS_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_POLICY_COMP_STATUS_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_POLICY_CHANGE_MGT (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
POLICY_ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE_TYPE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CONSTRAINT PK_DM_POLICY_CHANGE_MGT PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CHANGE_MGT_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_CHANGE_MGT_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_CHANGE_MGT_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY_CHANGE_MGT FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY_CHANGE_MGT
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_CHANGE_MGT_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
COMPLIANCE_STATUS_ID NUMBER(10) NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
FEATURE_CODE VARCHAR2(15) NOT NULL,
|
|
|
|
|
STATUS NUMBER(10) NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_COMPLIANCE_FEATURES_STATUS PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS
|
|
|
|
|
FOREIGN KEY (COMPLIANCE_STATUS_ID)
|
|
|
|
|
REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_COMPLIANCE_FEATURES_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_COMPLIANCE_FEATURES_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_POLICY_COMPLIANCE_FEATURES FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_POLICY_COMPLIANCE_FEATURES_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_ENROLMENT (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
OWNER VARCHAR2(50) NOT NULL,
|
|
|
|
|
OWNERSHIP VARCHAR2(45) DEFAULT NULL,
|
|
|
|
|
STATUS VARCHAR2(50) NULL,
|
|
|
|
|
DATE_OF_ENROLMENT TIMESTAMP(0) DEFAULT NULL,
|
|
|
|
|
DATE_OF_LAST_UPDATE TIMESTAMP(0) DEFAULT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_ENROLMENT_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_ENROLMENT_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_ENROLMENT FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_POLICY_COMP_FEATURES_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_POLICY_COMP_FEATURES_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_POLICY_COMPLIANCE_FEATURES
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_ENROLMENT_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_POLICY_COMP_FEATURES_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
@ -557,40 +566,47 @@ CREATE TABLE DM_APPLICATION (
|
|
|
|
|
IMAGE_URL VARCHAR2(100) DEFAULT NULL,
|
|
|
|
|
APP_PROPERTIES BLOB NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_APPLICATION_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_APPLICATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_APPLICATION_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_APPLICATION FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_APPLICATION
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_APPLICATION_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
APPLICATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID),
|
|
|
|
|
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
|
|
|
|
|
DM_APPLICATION (ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_APPLICATION_MAPPING_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_APPLICATION_MAPPING_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_APPLICATION_MAPPING FOR EACH ROW
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_APP_MAPPING_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_APP_MAPPING_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_APPLICATION_MAPPING
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_APPLICATION_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_DEVICE_APP_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
@ -604,18 +620,22 @@ CREATE TABLE DM_NOTIFICATION (
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
STATUS VARCHAR2(10) NULL,
|
|
|
|
|
DESCRIPTION VARCHAR2(100) NULL,
|
|
|
|
|
PRIMARY KEY (NOTIFICATION_ID),
|
|
|
|
|
CONSTRAINT PK_DM_NOTIFICATION PRIMARY KEY (NOTIFICATION_ID),
|
|
|
|
|
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID),
|
|
|
|
|
CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
|
|
|
DM_OPERATION (ID)
|
|
|
|
|
);
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_NOTIFICATION_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_NOTIFICATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_NOTIFICATION_seq_tr
|
|
|
|
|
BEFORE INSERT ON DM_NOTIFICATION FOR EACH ROW
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_NOTIFICATION
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.NOTIFICATION_ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_NOTIFICATION_seq.NEXTVAL INTO :NEW.NOTIFICATION_ID FROM DUAL;
|
|
|
|
@ -623,4 +643,3 @@ END;
|
|
|
|
|
/
|
|
|
|
|
-- NOTIFICATION TABLE END --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|