From 8821227de24ab8754f3650aa4a4a15f54f199a7d Mon Sep 17 00:00:00 2001 From: Dileesha Rajapakse Date: Thu, 26 May 2016 17:15:35 +0530 Subject: [PATCH] Fixed Oracle driver related syntax issues and table names --- .../main/resources/dbscripts/cdm/oracle.sql | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index 2cb94d5ed4b..93c6568f367 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -100,11 +100,11 @@ CREATE TABLE DM_DEVICE_GROUP_MAP ( REFERENCES DM_DEVICE (ID), CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) REFERENCES DM_GROUP (ID) -); - +) +/ -- 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 BEFORE INSERT ON DM_DEVICE_GROUP_MAP FOR EACH ROW WHEN (NEW.ID IS NULL) @@ -446,7 +446,7 @@ CREATE TABLE DM_DEVICE_POLICY_APPLIED ( CREATED_TIME TIMESTAMP(0) NULL , UPDATED_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 FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) @@ -631,11 +631,11 @@ CREATE TABLE DM_DEVICE_GROUP_POLICY ( CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID) -) ; - +) +/ -- 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 BEFORE INSERT ON DM_DEVICE_GROUP_POLICY FOR EACH ROW WHEN (NEW.ID IS NULL) @@ -756,11 +756,11 @@ CREATE TABLE DM_DEVICE_INFO ( FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ) -; +/ -- 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 BEFORE INSERT ON DM_DEVICE_INFO FOR EACH ROW WHEN (NEW.ID IS NULL) @@ -794,11 +794,11 @@ CREATE TABLE DM_DEVICE_LOCATION ( FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ) -; +/ -- 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 BEFORE INSERT ON DM_DEVICE_LOCATION FOR EACH ROW WHEN (NEW.ID IS NULL) @@ -836,11 +836,11 @@ CREATE TABLE DM_DEVICE_DETAIL ( CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) -); - +) +/ -- 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 BEFORE INSERT ON DM_DEVICE_DETAIL FOR EACH ROW WHEN (NEW.ID IS NULL) @@ -851,7 +851,7 @@ WHEN (NEW.ID IS NULL) -- DASHBOARD RELATED VIEWS -- -CREATE VIEW DEVICES_WITH_POLICY_COMPLIANCE_STATUS AS +CREATE VIEW POLICY_COMPLIANCE_INFO AS SELECT DEVICE_INFO.DEVICE_ID, DEVICE_INFO.DEVICE_IDENTIFICATION, @@ -879,8 +879,8 @@ STATUS AS IS_COMPLIANT FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_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 DM_DEVICE.ID AS DEVICE_ID, DM_DEVICE.DEVICE_IDENTIFICATION,