|
|
@ -655,3 +655,132 @@ WHEN (NEW.NOTIFICATION_ID IS NULL)
|
|
|
|
/
|
|
|
|
/
|
|
|
|
-- NOTIFICATION TABLE END --
|
|
|
|
-- NOTIFICATION TABLE END --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Device Info and Search Table --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_INFO';
|
|
|
|
|
|
|
|
EXCEPTION
|
|
|
|
|
|
|
|
WHEN OTHERS THEN NULL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_INFO (
|
|
|
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
|
|
|
DEVICE_ID NUMBER(10) NULL,
|
|
|
|
|
|
|
|
KEY_FIELD VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
VALUE_FIELD VARCHAR2(100) NULL,
|
|
|
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
|
|
|
,
|
|
|
|
|
|
|
|
CONSTRAINT DM_DEVICE_INFO_DEVICE
|
|
|
|
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_INFO_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_INFO_seq_tr
|
|
|
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_INFO FOR EACH ROW
|
|
|
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT DM_DEVICE_INFO_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE INDEX DM_DEVICE_INFO_DEVICE_idx ON DM_DEVICE_INFO (DEVICE_ID ASC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_LOCATION';
|
|
|
|
|
|
|
|
EXCEPTION
|
|
|
|
|
|
|
|
WHEN OTHERS THEN NULL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_LOCATION (
|
|
|
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
|
|
|
DEVICE_ID NUMBER(10) NULL,
|
|
|
|
|
|
|
|
LATITUDE BINARY_DOUBLE NULL,
|
|
|
|
|
|
|
|
LONGITUDE BINARY_DOUBLE NULL,
|
|
|
|
|
|
|
|
STREET1 VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
STREET2 VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
CITY VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
ZIP VARCHAR2(10) NULL,
|
|
|
|
|
|
|
|
STATE VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
COUNTRY VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
|
|
|
,
|
|
|
|
|
|
|
|
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
|
|
|
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_LOCATION_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_LOCATION_seq_tr
|
|
|
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_LOCATION FOR EACH ROW
|
|
|
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT DM_DEVICE_LOCATION_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE INDEX DM_DEVICE_LOCATION_DEVICE_idx ON DM_DEVICE_LOCATION (DEVICE_ID ASC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_DETAIL';
|
|
|
|
|
|
|
|
EXCEPTION
|
|
|
|
|
|
|
|
WHEN OTHERS THEN NULL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_DETAIL (
|
|
|
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
|
|
|
IMEI VARCHAR2(100) NULL,
|
|
|
|
|
|
|
|
IMSI VARCHAR2(100) NULL,
|
|
|
|
|
|
|
|
DEVICE_MODEL VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
VENDOR VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
OS_VERSION VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
BATTERY_LEVEL NUMBER(4) NULL,
|
|
|
|
|
|
|
|
INTERNAL_TOTAL_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
INTERNAL_AVAILABLE_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
EXTERNAL_TOTAL_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
EXTERNAL_AVAILABLE_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
OPERATOR VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
CONNECTION_TYPE VARCHAR2(10) NULL,
|
|
|
|
|
|
|
|
MOBILE_SIGNAL_STRENGTH NUMBER(5) NULL,
|
|
|
|
|
|
|
|
SSID VARCHAR2(45) NULL,
|
|
|
|
|
|
|
|
CPU_USAGE NUMBER(5) NULL,
|
|
|
|
|
|
|
|
TOTAL_RAM_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
AVAILABLE_RAM_MEMORY NUMBER(5) NULL,
|
|
|
|
|
|
|
|
PLUGGED_IN NUMBER(10) NULL,
|
|
|
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
|
|
|
,
|
|
|
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
|
|
|
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_DETAIL_seq START WITH 1 INCREMENT BY 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_DETAIL_seq_tr
|
|
|
|
|
|
|
|
BEFORE INSERT ON DM_DEVICE_DETAIL FOR EACH ROW
|
|
|
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT DM_DEVICE_DETAIL_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx ON DM_DEVICE_DETAIL (DEVICE_ID ASC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|