From a3eca63dfd6b6703119c593ec1cdef15583ff583 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Sun, 19 Feb 2023 23:37:22 +0530 Subject: [PATCH 1/4] Fix mssql dbscripts of DM_DB, APPM_DB --- .../dbscripts/cdm/application-mgt/mssql.sql | 26 +++++++++++-- .../main/resources/dbscripts/cdm/mssql.sql | 38 +++++++++---------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 0c55006976..9b2e89b3f7 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -1,6 +1,7 @@ -- ----------------------------------------------------- -- Table AP_APP -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP]') AND TYPE IN (N'U')) CREATE TABLE AP_APP( ID INTEGER NOT NULL IDENTITY, NAME VARCHAR(350) NOT NULL, @@ -18,6 +19,7 @@ CREATE TABLE AP_APP( -- ----------------------------------------------------- -- Table AP_APP_RELEASE -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_RELEASE]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_RELEASE( ID INTEGER NOT NULL IDENTITY, DESCRIPTION VARCHAR(max) NOT NULL, @@ -52,6 +54,7 @@ CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC); -- ----------------------------------------------------- -- Table AP_APP_REVIEW -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_REVIEW]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_REVIEW( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -74,6 +77,7 @@ CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELE -- ----------------------------------------------------- -- Table AP_APP_LIFECYCLE_STATE -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_LIFECYCLE_STATE]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_LIFECYCLE_STATE( ID INTEGER NOT NULL IDENTITY, CURRENT_STATE VARCHAR(45) NOT NULL, @@ -93,6 +97,7 @@ CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_S -- ----------------------------------------------------- -- Table AP_APP_TAG -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_TAG]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_TAG( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -103,6 +108,7 @@ CREATE TABLE AP_APP_TAG( -- ----------------------------------------------------- -- Table AP_DEVICE_SUBSCRIPTION -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_DEVICE_SUBSCRIPTION]') AND TYPE IN (N'U')) CREATE TABLE AP_DEVICE_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -126,6 +132,7 @@ CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIP -- ----------------------------------------------------- -- Table AP_GROUP_SUBSCRIPTION -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_GROUP_SUBSCRIPTION]') AND TYPE IN (N'U')) CREATE TABLE AP_GROUP_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -146,6 +153,7 @@ CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTI -- ----------------------------------------------------- -- Table AP_ROLE_SUBSCRIPTION -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_ROLE_SUBSCRIPTION]') AND TYPE IN (N'U')) CREATE TABLE AP_ROLE_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -166,6 +174,7 @@ CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION -- ----------------------------------------------------- -- Table AP_UNRESTRICTED_ROLE -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_UNRESTRICTED_ROLE]') AND TYPE IN (N'U')) CREATE TABLE AP_UNRESTRICTED_ROLE( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -181,6 +190,7 @@ CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID -- ----------------------------------------------------- -- Table AP_USER_SUBSCRIPTION -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_USER_SUBSCRIPTION]') AND TYPE IN (N'U')) CREATE TABLE AP_USER_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -201,6 +211,7 @@ CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION -- ----------------------------------------------------- -- Table AP_APP_CATEGORY -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_CATEGORY]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_CATEGORY( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -212,6 +223,7 @@ CREATE TABLE AP_APP_CATEGORY( -- ----------------------------------------------------- -- Table AP_APP_TAG_MAPPING -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_TAG_MAPPING]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_TAG_MAPPING( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -231,6 +243,7 @@ CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID AS -- ----------------------------------------------------- -- Table AP_APP_CATEGORY_MAPPING -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_CATEGORY_MAPPING]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_CATEGORY_MAPPING( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -250,6 +263,7 @@ CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx ON AP_APP_CATEGORY_MAPPING (AP -- ----------------------------------------------------- -- Table AP_APP_SUB_OP_MAPPING -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_SUB_OP_MAPPING]') AND TYPE IN (N'U')) CREATE TABLE AP_APP_SUB_OP_MAPPING ( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -265,6 +279,7 @@ CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_ -- ----------------------------------------------------- -- Table AP_SCHEDULED_SUBSCRIPTION -- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_SCHEDULED_SUBSCRIPTION]') AND TYPE IN (N'U')) CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TASK_NAME VARCHAR(100) NOT NULL, @@ -284,7 +299,8 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( -- ----------------------------------------------------- -- Table AP_IDENTITY_SERVER -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS AP_IDENTITY_SERVER ( +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_IDENTITY_SERVER]') AND TYPE IN (N'U')) +CREATE TABLE AP_IDENTITY_SERVER ( ID INTEGER NOT NULL IDENTITY, NAME VARCHAR(255) NOT NULL, PROVIDER_NAME VARCHAR(255) NOT NULL, @@ -299,8 +315,9 @@ CREATE TABLE IF NOT EXISTS AP_IDENTITY_SERVER ( -- ----------------------------------------------------- -- Table AP_IS_SP_APP_MAPPING --- -----------------------------------------------------; -CREATE TABLE IF NOT EXISTS AP_IS_SP_APP_MAPPING ( +-- ----------------------------------------------------- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_IS_SP_APP_MAPPING]') AND TYPE IN (N'U')) +CREATE TABLE AP_IS_SP_APP_MAPPING ( ID INTEGER NOT NULL IDENTITY, SP_UID VARCHAR(255) NOT NULL, AP_APP_ID INT NOT NULL, @@ -314,7 +331,8 @@ CREATE TABLE IF NOT EXISTS AP_IS_SP_APP_MAPPING ( -- ----------------------------------------------------- -- Table AP_APP_FAVOURITES -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_APP_FAVOURITES]') AND TYPE IN (N'U')) +CREATE TABLE AP_APP_FAVOURITES( ID INTEGER NOT NULL IDENTITY, AP_APP_ID INTEGER NOT NULL, USER_NAME VARCHAR(100) NOT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index c2310100ce..cad295b559 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -120,21 +120,6 @@ CREATE TABLE DM_OPERATION ( PRIMARY KEY (ID) ); -IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_STATUS]') AND TYPE IN (N'U')) -CREATE TABLE DM_DEVICE_STATUS ( - ID INTEGER IDENTITY(1,1) NOT NULL, - ENROLMENT_ID INTEGER NOT NULL, - DEVICE_ID INTEGER NOT NULL, - STATUS VARCHAR(50) DEFAULT NULL, - UPDATE_TIME DATETIME2 DEFAULT NULL, - CHANGED_BY VARCHAR(255) NOT NULL, - PRIMARY KEY (ID), - CONSTRAINT FK_DM_DEVICE_STATUS_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES - DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT FK_DM_DEVICE_STATUS_ENROLMENT FOREIGN KEY (ENROLMENT_ID) REFERENCES - DM_ENROLMENT (ID) ON DELETE CASCADE ON UPDATE CASCADE -); - IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_ENROLMENT]') AND TYPE IN (N'U')) CREATE TABLE DM_ENROLMENT ( ID INTEGER IDENTITY(1,1) NOT NULL, @@ -151,6 +136,21 @@ CREATE TABLE DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_STATUS]') AND TYPE IN (N'U')) +CREATE TABLE DM_DEVICE_STATUS ( + ID INTEGER IDENTITY(1,1) NOT NULL, + ENROLMENT_ID INTEGER NOT NULL, + DEVICE_ID INTEGER NOT NULL, + STATUS VARCHAR(50) DEFAULT NULL, + UPDATE_TIME DATETIME2 DEFAULT NULL, + CHANGED_BY VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT FK_DM_DEVICE_STATUS_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES + DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT FK_DM_DEVICE_STATUS_ENROLMENT FOREIGN KEY (ENROLMENT_ID) REFERENCES + DM_ENROLMENT (ID) ON DELETE CASCADE ON UPDATE CASCADE +); + IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_ENROLMENT_FK_DEVICE_ID' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT')) CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID); IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_ENROLMENT_DEVICE_ID_TENANT_ID' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT')) @@ -639,10 +639,10 @@ CREATE TABLE DM_OTP_DATA ( USERNAME VARCHAR(500) NOT NULL, EMAIL VARCHAR(100) NOT NULL, EMAIL_TYPE VARCHAR(20) NOT NULL, - META_INFO VARCHAR(20000) NOT NULL, + META_INFO VARCHAR(8000) NOT NULL, CREATED_AT DATETIME2(0) NOT NULL, EXPIRY_TIME INT NOT NULL DEFAULT 3600, - IS_EXPIRED BIT DEFAULT false, + IS_EXPIRED BIT DEFAULT 0, PRIMARY KEY (ID), CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) ); @@ -718,8 +718,8 @@ CREATE TABLE DM_GEOFENCE ( ID INT IDENTITY NOT NULL, FENCE_NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(MAX) DEFAULT NULL, - LATITUDE DECIMAL(3,5) DEFAULT NULL, - LONGITUDE DECIMAL(3,5) DEFAULT NULL, + LATITUDE DECIMAL(3) DEFAULT NULL, + LONGITUDE DECIMAL(3) DEFAULT NULL, RADIUS DECIMAL(30,4) DEFAULT NULL, GEO_JSON VARCHAR(MAX) DEFAULT NULL, FENCE_SHAPE VARCHAR(100) DEFAULT NULL, From e4a5f49b9c86b9f08cccc310a51cd38e4d84e377 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Tue, 21 Feb 2023 15:07:39 +0530 Subject: [PATCH 2/4] Fix dynamic task tables --- .../src/main/resources/dbscripts/cdm/mssql.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index cad295b559..32827a1d0c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -733,18 +733,18 @@ CREATE TABLE DM_GEOFENCE ( -- DYNAMIC TASK TABLES-- IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DYNAMIC_TASK]') AND TYPE IN (N'U')) -CREATE TABLE IF NOT EXISTS DYNAMIC_TASK ( +CREATE TABLE DYNAMIC_TASK ( DYNAMIC_TASK_ID INTEGER IDENTITY(1,1) NOT NULL, NAME VARCHAR(255) DEFAULT NULL , CRON VARCHAR(8000) DEFAULT NULL, - IS_ENABLED BOOLEAN NOT NULL DEFAULT FALSE, + IS_ENABLED BIT NOT NULL DEFAULT 0, TASK_CLASS_NAME VARCHAR(8000) DEFAULT NULL, TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (DYNAMIC_TASK_ID) ); -IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DYNAMIC_TASK_PROPERTIES]') -AND TYPE IN (N'U')) -CREATE TABLE IF NOT EXISTS DYNAMIC_TASK_PROPERTIES ( + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DYNAMIC_TASK_PROPERTIES]') AND TYPE IN (N'U')) +CREATE TABLE DYNAMIC_TASK_PROPERTIES ( DYNAMIC_TASK_ID INTEGER NOT NULL, PROPERTY_NAME VARCHAR(100) DEFAULT 0, PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, From fb3797774e8f4413bf306bcd7c65afb79c0708a6 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Thu, 23 Feb 2023 00:36:14 +0530 Subject: [PATCH 3/4] Add fix to load apps and create app --- .../dao/impl/application/SQLServerApplicationDAOImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java index 9ad0b9d4c0..bfce4e31fa 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java @@ -94,6 +94,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl { || StringUtils.isNotEmpty(filter.getAppReleaseType())) { sql += "LEFT JOIN AP_APP_RELEASE ON AP_APP.ID = AP_APP_RELEASE.AP_APP_ID "; } + sql += "WHERE AP_APP.TENANT_ID = ? "; if (StringUtils.isNotEmpty(filter.getAppType()) && !Constants.ALL.equalsIgnoreCase(filter.getAppType())) { sql += "AND AP_APP.TYPE = ? "; } @@ -128,7 +129,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl { sql += filter.getSortBy() +" "; } if (filter.getLimit() != -1) { - sql += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; + sql += "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; } sql += ") AS app_data ON app_data.ID = AP_APP.ID " + "LEFT JOIN (" @@ -145,6 +146,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { int paramIndex = 1; + stmt.setInt(paramIndex++, tenantId); if (StringUtils.isNotEmpty(filter.getAppType()) && !Constants.ALL.equalsIgnoreCase(filter.getAppType())) { stmt.setString(paramIndex++, filter.getAppType()); } From 5fca50f8d7068d3db239362efad3b854b40e2486 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Fri, 24 Feb 2023 10:25:13 +0530 Subject: [PATCH 4/4] Change latitude and longitude datatype --- .../src/main/resources/dbscripts/cdm/mssql.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 32827a1d0c..1c22ba25fc 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -718,8 +718,8 @@ CREATE TABLE DM_GEOFENCE ( ID INT IDENTITY NOT NULL, FENCE_NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(MAX) DEFAULT NULL, - LATITUDE DECIMAL(3) DEFAULT NULL, - LONGITUDE DECIMAL(3) DEFAULT NULL, + LATITUDE FLOAT DEFAULT NULL, + LONGITUDE FLOAT DEFAULT NULL, RADIUS DECIMAL(30,4) DEFAULT NULL, GEO_JSON VARCHAR(MAX) DEFAULT NULL, FENCE_SHAPE VARCHAR(100) DEFAULT NULL,