From 9d9ff9f3918d5e9fd10247e68e08fee7edd134e1 Mon Sep 17 00:00:00 2001 From: Rushdi Date: Mon, 21 Mar 2022 00:34:42 +0530 Subject: [PATCH] Update h2.sql with traccar group/device mapping tables --- .../src/main/resources/dbscripts/cdm/h2.sql | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index c03341d4785..24fab102c2a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -748,3 +748,29 @@ CREATE TABLE IF NOT EXISTS DM_GEOFENCE_EVENT_MAPPING ( ); -- END OF DM_GEOFENCE_GROUP_MAPPING TABLE-- + +-- DM_TRACCAR_GROUP_MAPPING TABLE-- +CREATE TABLE IF NOT EXISTS DM_TRACCAR_GROUP_MAPPING ( + ID INT NOT NULL AUTO_INCREMENT, + TRACCAR_GROUP_ID INT NOT NULL, + GROUP_ID INT NOT NULL, + TENANT_ID INT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_dm_group_traccar_group_mapping FOREIGN KEY (GROUP_ID) REFERENCES + DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT uk_traccar_group UNIQUE (TRACCAR_GROUP_ID, GROUP_ID, TENANT_ID) +); +-- END OF DM_TRACCAR_GROUP_MAPPING TABLE-- + +-- END OF DM_TRACCAR_DEVICE_MAPPING TABLE-- +CREATE TABLE IF NOT EXISTS DM_TRACCAR_DEVICE_MAPPING ( + ID INT NOT NULL AUTO_INCREMENT, + TRACCAR_DEVICE_ID INT NOT NULL, + DEVICE_ID INT NOT NULL, + TENANT_ID INT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_dm_device_traccar_device_mapping FOREIGN KEY (DEVICE_ID) REFERENCES + DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT uk_traccar_device UNIQUE (TRACCAR_DEVICE_ID, DEVICE_ID, TENANT_ID) +); +-- END OF DM_TRACCAR_DEVICE_MAPPING TABLE--