From 026132efd41b85342c602e5f44126e14cbc44d4b Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Wed, 25 Oct 2023 08:33:18 +0000 Subject: [PATCH] revert b9b2c97841e2e8ca8875c6cccaa54b6c8de155bd revert Added query for set foreign key --- .../src/test/resources/sql/h2.sql | 4 +--- .../src/main/resources/dbscripts/cdm/h2.sql | 5 +---- .../src/main/resources/dbscripts/cdm/mssql.sql | 4 +--- .../src/main/resources/dbscripts/cdm/mysql.sql | 4 +--- .../src/main/resources/dbscripts/cdm/oracle.sql | 4 +--- .../src/main/resources/dbscripts/cdm/postgresql.sql | 4 +--- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql index 952fe1a099..bee98d7dbf 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/sql/h2.sql @@ -39,7 +39,5 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( TENANT_ID INTEGER DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR(500) DEFAULT NULL, - PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) ON DELETE NO ACTION ON UPDATE NO ACTION + PRIMARY KEY (ID) ); \ No newline at end of file diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 0547f9ca79..b1f68e0570 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -15,10 +15,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( TENANT_ID INTEGER DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR(500) DEFAULT NULL, - PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) - + PRIMARY KEY (ID) ); CREATE TABLE IF NOT EXISTS DM_GROUP ( 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 a00068c5f9..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 @@ -25,9 +25,7 @@ CREATE TABLE DM_DEVICE_CERTIFICATE ( TENANT_ID INTEGER DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR(500) DEFAULT NULL, -PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) +PRIMARY KEY (ID) ); IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DEVICE_TYPE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_TYPE')) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 8107b71583..5e33d6b2b4 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -19,9 +19,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( TENANT_ID INTEGER DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR(500) DEFAULT NULL, - PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) + PRIMARY KEY (ID) )ENGINE = InnoDB; CREATE TABLE IF NOT EXISTS DM_GROUP ( diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index 043663a706..035f31d31d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -30,9 +30,7 @@ CREATE TABLE DM_DEVICE_CERTIFICATE ( TENANT_ID NUMBER(10) DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR2(500) DEFAULT NULL, - PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) + PRIMARY KEY (ID) ) / diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 3bad8667e2..1b9393885c 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -843,8 +843,6 @@ CREATE TABLE DM_DEVICE_CERTIFICATE ( TENANT_ID NUMBER(10) DEFAULT 0, DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR2(500) DEFAULT NULL, - PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER) - REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) + PRIMARY KEY (ID) )