From 1921b3e54db4949568461d6dea63cf350efa56b3 Mon Sep 17 00:00:00 2001 From: Kavin Prathaban Date: Thu, 27 Jul 2023 05:13:56 +0000 Subject: [PATCH] Add missing device identifier column to dbscripts (#189) ## Purpose device identifier column is missing in dm_device_certificate table Co-authored-by: prathabanKavin Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/189 Co-authored-by: Kavin Prathaban Co-committed-by: Kavin Prathaban --- .../src/main/resources/dbscripts/cdm/h2.sql | 13 +++++++------ .../src/main/resources/dbscripts/cdm/mssql.sql | 7 ++++--- .../src/main/resources/dbscripts/cdm/mysql.sql | 13 +++++++------ .../src/main/resources/dbscripts/cdm/oracle.sql | 7 ++++--- .../src/main/resources/dbscripts/cdm/postgresql.sql | 11 +++++++++++ 5 files changed, 33 insertions(+), 18 deletions(-) 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 20786cfe2d4..b3bc1c36ea3 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 @@ -9,12 +9,13 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( ); CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( - ID INTEGER auto_increment NOT NULL, - SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, - CERTIFICATE BLOB DEFAULT NULL, - TENANT_ID INTEGER DEFAULT 0, - USERNAME VARCHAR(500) DEFAULT NULL, - PRIMARY KEY (ID) + ID INTEGER auto_increment NOT NULL, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), + USERNAME VARCHAR(500) DEFAULT NULL, + 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 5b6b3b93f14..34ff7ef1a7f 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 @@ -21,9 +21,10 @@ IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[D CREATE TABLE DM_DEVICE_CERTIFICATE ( ID INTEGER IDENTITY(1,1) NOT NULL, SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, - CERTIFICATE VARBINARY(max) DEFAULT NULL, - TENANT_ID INTEGER DEFAULT 0, - USERNAME VARCHAR(500) DEFAULT NULL, + CERTIFICATE VARBINARY(max) DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), + USERNAME VARCHAR(500) DEFAULT NULL, PRIMARY KEY (ID) ); 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 86da197b12f..e55274e49f2 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 @@ -13,12 +13,13 @@ CREATE INDEX IDX_DEVICE_NAME ON DM_DEVICE_TYPE (NAME); CREATE INDEX IDX_DEVICE_TYPE_DEVICE_NAME ON DM_DEVICE_TYPE(ID, NAME); CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( - ID INTEGER auto_increment NOT NULL, - SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, - CERTIFICATE BLOB DEFAULT NULL, - TENANT_ID INTEGER DEFAULT 0, - USERNAME VARCHAR(500) DEFAULT NULL, - PRIMARY KEY (ID) + ID INTEGER auto_increment NOT NULL, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), + USERNAME VARCHAR(500) DEFAULT NULL, + 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 6cc55f7e741..708f135b781 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 @@ -24,10 +24,11 @@ WHEN (NEW.ID IS NULL) / CREATE TABLE DM_DEVICE_CERTIFICATE ( - ID NUMBER(10) NOT NULL, - SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL, - CERTIFICATE BLOB DEFAULT NULL, + ID NUMBER(10) NOT NULL, + SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, TENANT_ID NUMBER(10) DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), USERNAME VARCHAR2(500) DEFAULT NULL, 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 b1fc128cf91..3ff77c0242f 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 @@ -830,4 +830,15 @@ CREATE TABLE SUB_OPERATION_TEMPLATE ( -- END OF SUB_OPERATION_TEMPLATE TABLE-- +CREATE SEQUENCE DM_DEVICE_CERTIFICATE_seq; + +CREATE TABLE DM_DEVICE_CERTIFICATE ( + ID NUMBER(10) NOT NULL, + SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID NUMBER(10) DEFAULT 0, + DEVICE_IDENTIFIER VARCHAR(300), + USERNAME VARCHAR2(500) DEFAULT NULL, + PRIMARY KEY (ID) +)