Merge branch 'db-scrips-update' into 'master'

Add index to DM_DEVICE_DETAIL table

See merge request entgra/carbon-device-mgt!567
4.x.x
Charitha Goonetilleke 5 years ago
commit 9237f8a54f

@ -502,6 +502,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ON UPDATE NO ACTION 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 CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS
( (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,

@ -581,6 +581,9 @@ CREATE TABLE DM_DEVICE_DETAIL (
ON UPDATE NO ACTION 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')) 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( CREATE TABLE DM_DEVICE_TYPE_PLATFORM(
ID int IDENTITY(1, 1) NOT NULL, ID int IDENTITY(1, 1) NOT NULL,

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

@ -912,6 +912,10 @@ CREATE TABLE DM_DEVICE_DETAIL (
REFERENCES DM_ENROLMENT (ID) 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 -- Generate ID using sequence and trigger
CREATE SEQUENCE DM_DEVICE_DETAIL_seq START WITH 1 INCREMENT BY 1 NOCACHE 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) REFERENCES DM_ENROLMENT (ID)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE 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_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 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 -- -- METADATA TABLE --
CREATE TABLE IF NOT EXISTS DM_METADATA ( CREATE TABLE IF NOT EXISTS DM_METADATA (

Loading…
Cancel
Save