diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 89de2ce7a0..7090ca20ff 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -672,6 +672,7 @@ CREATE TABLE DM_METADATA ( -- END OF METADATA TABLE -- -- DM_OTP_DATA TABLE -- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_OTP_DATA]') AND TYPE IN (N'U')) CREATE TABLE DM_OTP_DATA ( ID INT IDENTITY NOT NULL, OTP_TOKEN VARCHAR(100) NOT NULL, @@ -721,7 +722,7 @@ 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'); -IF NOT EXISTS (SELECT * FROM SYS.VIEWS WHERE NAME = 'CREATE VIEW FEATURE_NON_COMPLIANCE_INFO') +IF NOT EXISTS (SELECT * FROM SYS.VIEWS WHERE NAME = 'FEATURE_NON_COMPLIANCE_INFO') exec('CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS SELECT TOP 100 PERCENT DM_DEVICE.ID AS DEVICE_ID, @@ -904,7 +905,7 @@ CREATE TABLE SUB_OPERATION_TEMPLATE ( OPERATION_DEFINITION VARCHAR(MAX) NOT NULL, OPERATION_CODE varchar(100) NOT NULL, SUB_TYPE_ID VARCHAR(45) NOT NULL, - DEVICE_TYPE VARCHAR(25) NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, CREATE_TIMESTAMP BIGINT NULL DEFAULT NULL, UPDATE_TIMESTAMP BIGINT NULL DEFAULT NULL, PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID), @@ -912,4 +913,4 @@ CREATE TABLE SUB_OPERATION_TEMPLATE ( CONSTRAINT fk_SUB_OPERATION_TEMPLATE_DM_DEVICE_SUB_TYPE FOREIGN KEY (SUB_TYPE_ID, DEVICE_TYPE) REFERENCES DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, DEVICE_TYPE) ); --- END SUB_OPERATION_TEMPLATE TABLE-- \ No newline at end of file +-- END SUB_OPERATION_TEMPLATE TABLE--