From ac0f9f975194895f723f46f6ad2349337952268f Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 10 Dec 2019 10:46:06 +0530 Subject: [PATCH 1/2] Add swagger --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml index e7426237cb2..93c3719b980 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -26,12 +26,30 @@ + + + + + + + + + + + + + + + + + + From d642a7287f1f84e0f934d9bbd2774976d4c876f0 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 10 Dec 2019 10:46:42 +0530 Subject: [PATCH 2/2] Fix Postgre db script issues --- .../resources/dbscripts/cdm/postgresql.sql | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index f52bed8d00a..c527642e8c8 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -490,26 +490,31 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION ( ON DELETE NO ACTION ON UPDATE NO ACTION ); +CREATE INDEX DM_DEVICE_LOCATION_GEO_hashx ON DM_DEVICE_LOCATION(GEO_HASH ASC); -CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS -( - ID BIGSERIAL NOT NULL PRIMARY KEY, - DEVICE_ID INT NOT NULL, - DEVICE_ID_NAME VARCHAR(255) NOT NULL, - TENANT_ID INT NOT NULL, - DEVICE_TYPE_NAME VARCHAR(45) NOT NULL, - LATITUDE DOUBLE PRECISION NULL, - LONGITUDE DOUBLE PRECISION NULL, - SPEED FLOAT NULL, - HEADING FLOAT NULL, - TIMESTAMP BIGINT(15) NOT NULL, - GEO_HASH VARCHAR(45) NULL, - DEVICE_OWNER VARCHAR(45) NULL, - DEVICE_ALTITUDE DOUBLE PRECISION NULL, - DISTANCE DOUBLE PRECISION NULL, -); -CREATE INDEX DM_DEVICE_LOCATION_GEO_hashx ON DM_DEVICE_LOCATION(GEO_HASH ASC); +CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS ( + ID BIGSERIAL NOT NULL PRIMARY KEY, + DEVICE_ID INTEGER NOT NULL, + DEVICE_ID_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + DEVICE_TYPE_NAME VARCHAR(45) NOT NULL, + LATITUDE DOUBLE PRECISION NULL, + LONGITUDE DOUBLE PRECISION NULL, + SPEED FLOAT NULL, + HEADING FLOAT NULL, + TIMESTAMP BIGINT NOT NULL, + GEO_HASH VARCHAR(45) NULL, + DEVICE_OWNER VARCHAR(45) NULL, + DEVICE_ALTITUDE DOUBLE PRECISION NULL, + DISTANCE DOUBLE PRECISION NULL, + CONSTRAINT DM_DEVICE_HISTORY_LAST_SEVEN_DAYS + FOREIGN KEY (DEVICE_ID) + REFERENCES DM_DEVICE (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION +); +CREATE INDEX DM_DEVICE_HISTORY_LAST_SEVEN_DAYS_GEO_hashx ON DM_DEVICE_HISTORY_LAST_SEVEN_DAYS(GEO_HASH ASC); CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( ID BIGSERIAL NOT NULL PRIMARY KEY, @@ -543,20 +548,19 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( ON UPDATE NO ACTION ); -CREATE SEQUENCE `DM_DEVICE_TYPE_PLATFORM`_seq; - -CREATE TABLE IF NOT EXISTS `DM_DEVICE_TYPE_PLATFORM` ( - ID INT NOT NULL DEFAULT NEXTVAL ('`DM_DEVICE_TYPE_PLATFORM`_seq'), +CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_PLATFORM ( + ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_TYPE_ID INT DEFAULT 0, VERSION_NAME VARCHAR(100) NULL, VERSION_STATUS VARCHAR(100) DEFAULT 'ACTIVE', - PRIMARY KEY (ID), - CONSTRAINT DM_DEVICE_TYPE_DM_DEVICE_TYPE_PLATFORM_MAPPING FOREIGN KEY (DEVICE_TYPE_ID) - REFERENCES DM_DEVICE_TYPE (ID) - ON DELETE CASCADE - ON UPDATE CASCADE, - CONSTRAINT device_type_version_uk UNIQUE (DEVICE_TYPE_ID, VERSION_NAME) - ) + CONSTRAINT FK_DM_DEVICE_TYPE_PLATFORM_MAPPING + FOREIGN KEY (DEVICE_TYPE_ID) + REFERENCES DM_DEVICE_TYPE (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT device_type_version_uk + UNIQUE (DEVICE_TYPE_ID, VERSION_NAME) +); -- DASHBOARD RELATED VIEWS --