Add index to DM_DEVICE_DETAIL table

revert-70ac1926
Saad Sahibjan 5 years ago
parent f27ae354a8
commit 905537f9af

@ -502,6 +502,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ON UPDATE NO ACTION
);
CREATE INDEX IDX_DM_DEVICE_DETAIL_DID_EID ON DM_DEVICE_DETAIL(DEVICE_ID, ENROLMENT_ID);
CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS
(
ID INTEGER AUTO_INCREMENT NOT NULL,

@ -581,6 +581,9 @@ CREATE TABLE DM_DEVICE_DETAIL (
ON UPDATE NO ACTION
);
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DM_DEVICE_DETAIL_DID_EID' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_DETAIL'))
CREATE INDEX IDX_DM_DEVICE_DETAIL_DID_EID ON DM_DEVICE_DETAIL(DEVICE_ID, ENROLMENT_ID);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_TYPE_PLATFORM]') AND TYPE IN (N'U'))
CREATE TABLE DM_DEVICE_TYPE_PLATFORM(
ID int IDENTITY(1, 1) NOT NULL,

@ -599,6 +599,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
)
ENGINE = InnoDB;
CREATE INDEX IDX_DM_DEVICE_DETAIL_DID_EID ON DM_DEVICE_DETAIL(DEVICE_ID, ENROLMENT_ID);
-- -----------------------------------------------------
-- Table `DM_DEVICE_TYPE_PLATFORM`
-- -----------------------------------------------------

@ -912,6 +912,10 @@ CREATE TABLE DM_DEVICE_DETAIL (
REFERENCES DM_ENROLMENT (ID)
)
/
CREATE INDEX IDX_DM_DEVICE_DETAIL_DID_EID ON DM_DEVICE_DETAIL(DEVICE_ID, ENROLMENT_ID)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE DM_DEVICE_DETAIL_seq START WITH 1 INCREMENT BY 1 NOCACHE
/

@ -600,11 +600,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
REFERENCES DM_ENROLMENT (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
;
);
CREATE INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx ON DM_DEVICE_DETAIL (DEVICE_ID ASC);
CREATE INDEX FK_DM_ENROLMENT_DEVICE_DETAILS_idx ON DM_DEVICE_DETAIL (ENROLMENT_ID ASC);
CREATE INDEX IDX_DM_DEVICE_DETAIL_DID_EID ON DM_DEVICE_DETAIL(DEVICE_ID, ENROLMENT_ID);
-- METADATA TABLE --
CREATE TABLE IF NOT EXISTS DM_METADATA (

Loading…
Cancel
Save