From ebc896ccd43b86c3dda0fce3efca159ec057451e Mon Sep 17 00:00:00 2001 From: Vishanth Date: Thu, 15 Dec 2016 10:30:56 +0530 Subject: [PATCH] removing the device type from constraint to support multi tenancy since it is not unique --- .../src/main/resources/dbscripts/cdm/h2.sql | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql index 8a5195b4cd7..eb30a07b12e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -147,8 +147,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE ( UPDATED_TIME DATETIME NOT NULL , PRIMARY KEY (ID) , CONSTRAINT DM_PROFILE_DEVICE_TYPE - FOREIGN KEY (DEVICE_TYPE ) - REFERENCES DM_DEVICE_TYPE (NAME) + FOREIGN KEY (DEVICE_TYPE, TENANT_ID) + REFERENCES DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); @@ -200,11 +200,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( FOREIGN KEY (POLICY_ID ) REFERENCES DM_POLICY (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE - FOREIGN KEY (DEVICE_TYPE ) - REFERENCES DM_DEVICE_TYPE (NAME) - ON DELETE NO ACTION ON UPDATE NO ACTION );