|
|
@ -100,11 +100,11 @@ CREATE TABLE DM_DEVICE_GROUP_MAP (
|
|
|
|
REFERENCES DM_DEVICE (ID),
|
|
|
|
REFERENCES DM_DEVICE (ID),
|
|
|
|
CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
);
|
|
|
|
)
|
|
|
|
|
|
|
|
/
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
CREATE SEQUENCE DM_DEVICE_GROUP_MAP_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
CREATE SEQUENCE DM_DEVICE_GROUP_MAP_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_GROUP_MAP_seq_tr
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_GROUP_MAP_seq_tr
|
|
|
|
BEFORE INSERT ON DM_DEVICE_GROUP_MAP FOR EACH ROW
|
|
|
|
BEFORE INSERT ON DM_DEVICE_GROUP_MAP FOR EACH ROW
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
@ -446,7 +446,7 @@ CREATE TABLE DM_DEVICE_POLICY_APPLIED (
|
|
|
|
CREATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
CREATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
UPDATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
UPDATED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
APPLIED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
APPLIED_TIME TIMESTAMP(0) NULL ,
|
|
|
|
CONSTRAINT PK_DM_POLICY_DEV_APPLIED PRIMARY KEY (ID) ,
|
|
|
|
CONSTRAINT PK_DM_POLICY_DEV_APPLIED PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT FK_DM_POLICY_DEV_APPLIED
|
|
|
|
CONSTRAINT FK_DM_POLICY_DEV_APPLIED
|
|
|
|
FOREIGN KEY (DEVICE_ID )
|
|
|
|
FOREIGN KEY (DEVICE_ID )
|
|
|
|
REFERENCES DM_DEVICE (ID )
|
|
|
|
REFERENCES DM_DEVICE (ID )
|
|
|
@ -631,11 +631,11 @@ CREATE TABLE DM_DEVICE_GROUP_POLICY (
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
) ;
|
|
|
|
)
|
|
|
|
|
|
|
|
/
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
CREATE SEQUENCE DM_DEVICE_GROUP_POLICY_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
CREATE SEQUENCE DM_DEVICE_GROUP_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_GROUP_POLICY_seq_tr
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_GROUP_POLICY_seq_tr
|
|
|
|
BEFORE INSERT ON DM_DEVICE_GROUP_POLICY FOR EACH ROW
|
|
|
|
BEFORE INSERT ON DM_DEVICE_GROUP_POLICY FOR EACH ROW
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
@ -756,11 +756,11 @@ CREATE TABLE DM_DEVICE_INFO (
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
;
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
CREATE SEQUENCE DM_DEVICE_INFO_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
CREATE SEQUENCE DM_DEVICE_INFO_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_INFO_seq_tr
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_INFO_seq_tr
|
|
|
|
BEFORE INSERT ON DM_DEVICE_INFO FOR EACH ROW
|
|
|
|
BEFORE INSERT ON DM_DEVICE_INFO FOR EACH ROW
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
@ -794,11 +794,11 @@ CREATE TABLE DM_DEVICE_LOCATION (
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
;
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
CREATE SEQUENCE DM_DEVICE_LOCATION_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
CREATE SEQUENCE DM_DEVICE_LOCATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_LOCATION_seq_tr
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_LOCATION_seq_tr
|
|
|
|
BEFORE INSERT ON DM_DEVICE_LOCATION FOR EACH ROW
|
|
|
|
BEFORE INSERT ON DM_DEVICE_LOCATION FOR EACH ROW
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
@ -836,11 +836,11 @@ CREATE TABLE DM_DEVICE_DETAIL (
|
|
|
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
|
|
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
);
|
|
|
|
)
|
|
|
|
|
|
|
|
/
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
CREATE SEQUENCE DM_DEVICE_DETAIL_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
CREATE SEQUENCE DM_DEVICE_DETAIL_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_DETAIL_seq_tr
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_DETAIL_seq_tr
|
|
|
|
BEFORE INSERT ON DM_DEVICE_DETAIL FOR EACH ROW
|
|
|
|
BEFORE INSERT ON DM_DEVICE_DETAIL FOR EACH ROW
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
@ -851,7 +851,7 @@ WHEN (NEW.ID IS NULL)
|
|
|
|
|
|
|
|
|
|
|
|
-- DASHBOARD RELATED VIEWS --
|
|
|
|
-- DASHBOARD RELATED VIEWS --
|
|
|
|
|
|
|
|
|
|
|
|
CREATE VIEW DEVICES_WITH_POLICY_COMPLIANCE_STATUS AS
|
|
|
|
CREATE VIEW POLICY_COMPLIANCE_INFO AS
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
DEVICE_INFO.DEVICE_ID,
|
|
|
|
DEVICE_INFO.DEVICE_ID,
|
|
|
|
DEVICE_INFO.DEVICE_IDENTIFICATION,
|
|
|
|
DEVICE_INFO.DEVICE_IDENTIFICATION,
|
|
|
@ -879,8 +879,8 @@ STATUS AS IS_COMPLIANT
|
|
|
|
FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
|
|
|
|
FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
|
|
|
|
ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
|
|
|
|
ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
|
|
|
|
ORDER BY DEVICE_INFO.DEVICE_ID;
|
|
|
|
ORDER BY DEVICE_INFO.DEVICE_ID;
|
|
|
|
|
|
|
|
/
|
|
|
|
CREATE VIEW DEVICES_WITH_NON_COMPLIANT_FEATURES AS
|
|
|
|
CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
DM_DEVICE.ID AS DEVICE_ID,
|
|
|
|
DM_DEVICE.DEVICE_IDENTIFICATION,
|
|
|
|
DM_DEVICE.DEVICE_IDENTIFICATION,
|
|
|
|