From b8542bfffd851adae92fef1c1325c0718b30411c Mon Sep 17 00:00:00 2001 From: Gimhan-minion Date: Fri, 30 Aug 2024 01:44:40 +0530 Subject: [PATCH] Fix data type inconsistency in tag db scripts --- .../src/test/resources/sql/h2.sql | 6 +++--- .../src/main/resources/dbscripts/cdm/h2.sql | 6 +++--- .../src/main/resources/dbscripts/cdm/mssql.sql | 10 +++++----- .../src/main/resources/dbscripts/cdm/mysql.sql | 10 +++++----- .../src/main/resources/dbscripts/cdm/oracle.sql | 6 +++--- .../src/main/resources/dbscripts/cdm/postgresql.sql | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql index 7ee776da58..323f52762a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql @@ -672,7 +672,7 @@ CREATE TABLE IF NOT EXISTS DM_METADATA ( -- DM_TAG TABLE -- CREATE TABLE IF NOT EXISTS DM_TAG ( - ID BIGINT AUTO_INCREMENT, + ID INTEGER AUTO_INCREMENT, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255) NULL, TENANT_ID INTEGER NOT NULL, @@ -683,8 +683,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG ( -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + TAG_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID), 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 7507ca0d59..6ba0077069 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 @@ -878,7 +878,7 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES ( -- DM_TAG TABLE -- CREATE TABLE IF NOT EXISTS DM_TAG ( - ID BIGINT AUTO_INCREMENT, + ID INTEGER AUTO_INCREMENT, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255) NULL, TENANT_ID INTEGER NOT NULL, @@ -889,8 +889,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG ( -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + TAG_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID), 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 dc39bb4d16..272066798d 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 @@ -954,19 +954,19 @@ END; -- DM_TAG TABLE -- CREATE TABLE IF NOT EXISTS DM_TAG ( - ID BIGINT IDENTITY(1,1) PRIMARY KEY, + ID INTEGER IDENTITY(1,1) PRIMARY KEY, NAME NVARCHAR(255) NOT NULL, DESCRIPTION NVARCHAR(255) NULL, - TENANT_ID INT NOT NULL, + TENANT_ID INTEGER NOT NULL, CONSTRAINT DM_TAG_NAME_TENANT_UNIQUE UNIQUE (NAME, TENANT_ID) ); -- END OF DM_TAG TABLE -- -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, - TENANT_ID INT NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + TAG_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID), FOREIGN KEY (TAG_ID) REFERENCES DM_TAG(ID) ON DELETE CASCADE 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 a943265bdb..773fe53b34 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 @@ -953,19 +953,19 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES ( -- DM_TAG TABLE -- CREATE TABLE IF NOT EXISTS DM_TAG ( - ID BIGINT AUTO_INCREMENT PRIMARY KEY, + ID INTEGER AUTO_INCREMENT PRIMARY KEY, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255) NULL, - TENANT_ID INT NOT NULL, + TENANT_ID INTEGER NOT NULL, CONSTRAINT DM_TAG_NAME_TENANT_UNIQUE UNIQUE (NAME, TENANT_ID) ); -- END OF DM_TAG TABLE -- -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, - TENANT_ID INT NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + TAG_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID), FOREIGN KEY (TAG_ID) REFERENCES DM_TAG(ID) ON DELETE CASCADE 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 2fa51b9d49..1b1071c290 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 @@ -1258,7 +1258,7 @@ END; -- DM_TAG TABLE -- CREATE TABLE DM_TAG ( - ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY, + ID NUMBER(10) GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, DESCRIPTION VARCHAR2(255) NULL, TENANT_ID NUMBER(10) NOT NULL, @@ -1268,8 +1268,8 @@ CREATE TABLE DM_TAG ( -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID NUMBER(19) NOT NULL, - TAG_ID NUMBER(19) NOT NULL, + ENROLMENT_ID NUMBER(10) NOT NULL, + TAG_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(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 d9bce9fd04..31591893e1 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 @@ -884,7 +884,7 @@ CREATE TABLE IF NOT EXISTS DM_CEA_POLICIES ( -- DM_TAG TABLE -- CREATE TABLE IF NOT EXISTS DM_TAG ( - ID BIGSERIAL PRIMARY KEY, + ID INTEGER PRIMARY KEY, NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255) NULL, TENANT_ID INTEGER NOT NULL, @@ -894,8 +894,8 @@ CREATE TABLE IF NOT EXISTS DM_TAG ( -- DM_DEVICE_TAG_MAPPING TABLE -- CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING ( - ENROLMENT_ID BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + TAG_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID), FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID), -- 2.36.3