diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 2e3654d6d08..a1581e19d3f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -99,7 +99,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( -- POLICY RELATED TABLES --- -CREATE TABLE DM_PROFILE ( +CREATE TABLE IF NOT EXISTS DM_PROFILE ( ID BIGSERIAL NOT NULL PRIMARY KEY, PROFILE_NAME VARCHAR(45) NOT NULL , TENANT_ID INTEGER NOT NULL , @@ -113,7 +113,7 @@ CREATE TABLE DM_PROFILE ( ON UPDATE NO ACTION ); -CREATE TABLE DM_POLICY ( +CREATE TABLE IF NOT EXISTS DM_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, NAME VARCHAR(45) DEFAULT NULL , DESCRIPTION VARCHAR(1000) NULL, @@ -131,7 +131,7 @@ CREATE TABLE DM_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE DM_DEVICE_POLICY ( +CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL , ENROLMENT_ID INTEGER NOT NULL, @@ -149,7 +149,7 @@ CREATE TABLE DM_DEVICE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE DM_DEVICE_TYPE_POLICY ( +CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( ID INTEGER NOT NULL, DEVICE_TYPE_ID INTEGER NOT NULL , POLICY_ID INTEGER NOT NULL , @@ -166,7 +166,7 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE DM_PROFILE_FEATURES ( +CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( ID BIGSERIAL NOT NULL PRIMARY KEY, PROFILE_ID INTEGER NOT NULL, FEATURE_CODE VARCHAR(30) NOT NULL, @@ -180,7 +180,7 @@ CREATE TABLE DM_PROFILE_FEATURES ( ON UPDATE NO ACTION ); -CREATE TABLE DM_ROLE_POLICY ( +CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, ROLE_NAME VARCHAR(45) NOT NULL , POLICY_ID INTEGER NOT NULL, @@ -191,7 +191,7 @@ CREATE TABLE DM_ROLE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE DM_USER_POLICY ( +CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, POLICY_ID INT NOT NULL , USERNAME VARCHAR(45) NOT NULL, @@ -202,7 +202,7 @@ CREATE TABLE DM_USER_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE DM_DEVICE_POLICY_APPLIED ( +CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL , ENROLMENT_ID INTEGER NOT NULL,