Merge branch 'master' into 'master'

Fix Postgre db script issues

See merge request entgra/carbon-device-mgt!403
feature/appm-store/pbac
Charitha Goonetilleke 5 years ago
commit 5b2612c556

@ -26,12 +26,30 @@
<jaxrs:server id="services-10" address="/">
<jaxrs:serviceBeans>
<ref bean="configManagementService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers" />
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource" />
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="resourcePackage" value="io.entgra.carbon.device.mgt.config.jaxrs"/>
<property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/>
<property name="schemes" value="https" />
<property name="basePath" value="/api/device-mgt-config/v1.0"/>
<property name="title" value="Device Management Dynamic COnfiguration Service API Definitions"/>
<property name="contact" value="dev@entgra.io"/>
<property name="license" value="Apache 2.0"/>
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
<property name="scan" value="true"/>
</bean>
<bean id="configManagementService"
class="io.entgra.carbon.device.mgt.config.jaxrs.service.impl.DeviceManagementConfigServiceImpl"/>
<bean id="jsonProvider" class="io.entgra.carbon.device.mgt.config.jaxrs.common.GsonMessageBodyHandler"/>

@ -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
(
CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS (
ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_ID INT NOT NULL,
DEVICE_ID INTEGER NOT NULL,
DEVICE_ID_NAME VARCHAR(255) NOT NULL,
TENANT_ID INT 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(15) NOT 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_LOCATION_GEO_hashx ON DM_DEVICE_LOCATION(GEO_HASH ASC);
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)
CONSTRAINT FK_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)
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT device_type_version_uk
UNIQUE (DEVICE_TYPE_ID, VERSION_NAME)
);
-- DASHBOARD RELATED VIEWS --

Loading…
Cancel
Save