|
|
|
@ -73,6 +73,65 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- DM_GEOFENCE TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
FENCE_NAME VARCHAR(255) NOT NULL,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
|
LATITUDE DOUBLE DEFAULT NULL,
|
|
|
|
|
LONGITUDE DOUBLE DEFAULT NULL,
|
|
|
|
|
RADIUS DOUBLE DEFAULT NULL,
|
|
|
|
|
GEO_JSON TEXT DEFAULT NULL,
|
|
|
|
|
FENCE_SHAPE VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
|
OWNER VARCHAR(255) NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_GEOFENCE TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_GEOFENCE_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GEOFENCE_GROUP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
FENCE_ID INT NOT NULL,
|
|
|
|
|
GROUP_ID INT NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_geofence_group_mapping_geofence FOREIGN KEY (FENCE_ID) REFERENCES
|
|
|
|
|
DM_GEOFENCE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
|
CONSTRAINT fk_dm_geofence_group_mapping_group FOREIGN KEY (GROUP_ID) REFERENCES
|
|
|
|
|
DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_GEOFENCE_GROUP_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_EVENT TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
EVENT_SOURCE VARCHAR(100) NOT NULL,
|
|
|
|
|
EVENT_LOGIC VARCHAR(100) NOT NULL,
|
|
|
|
|
ACTIONS TEXT DEFAULT NULL,
|
|
|
|
|
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_DEVICE_EVENT TABLE --
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_EVENT_GROUP_MAPPING TABLE--
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_EVENT_GROUP_MAPPING
|
|
|
|
|
(
|
|
|
|
|
ID INT NOT NULL AUTO_INCREMENT,
|
|
|
|
|
EVENT_ID INT NOT NULL,
|
|
|
|
|
GROUP_ID INT NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_event_group_mapping_event FOREIGN KEY (EVENT_ID) REFERENCES
|
|
|
|
|
DM_DEVICE_EVENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
|
CONSTRAINT fk_dm_event_group_mapping_group FOREIGN KEY (GROUP_ID) REFERENCES
|
|
|
|
|
DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_DEVICE_EVENT_GROUP_MAPPING TABLE--
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
|
|
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
|
|
|
TYPE VARCHAR(50) NOT NULL,
|
|
|
|
|