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

Add index to DM_DEVICE_INFO table

See merge request entgra/carbon-device-mgt!564
merge-requests/567/merge
Dharmakeerthi Lasantha 5 years ago
commit ef8629fed6

@ -435,6 +435,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ON UPDATE NO ACTION
);
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO(DEVICE_ID, ENROLMENT_ID, KEY_FIELD);
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,

@ -488,6 +488,9 @@ CREATE TABLE DM_DEVICE_INFO (
ON UPDATE NO ACTION
);
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DM_DEVICE_INFO_DID_EID_KFIELD' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_INFO'))
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO(DEVICE_ID, ENROLMENT_ID, KEY_FIELD);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_LOCATION]') AND TYPE IN (N'U'))
CREATE TABLE DM_DEVICE_LOCATION (
ID INTEGER IDENTITY(1,1) NOT NULL,
@ -670,4 +673,4 @@ DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND
DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
ORDER BY TENANT_ID, DEVICE_ID');
-- END OF DASHBOARD RELATED VIEWS --
-- END OF DASHBOARD RELATED VIEWS --

@ -506,6 +506,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
)
ENGINE = InnoDB;
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO(DEVICE_ID, ENROLMENT_ID, KEY_FIELD);
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL,

@ -788,6 +788,9 @@ CREATE TABLE DM_DEVICE_INFO (
)
/
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO(DEVICE_ID, ENROLMENT_ID, KEY_FIELD)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE DM_DEVICE_INFO_seq START WITH 1 INCREMENT BY 1 NOCACHE
/

@ -524,8 +524,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
REFERENCES DM_ENROLMENT (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
;
);
CREATE INDEX IDX_DM_DEVICE_INFO_DID_EID_KFIELD ON DM_DEVICE_INFO(DEVICE_ID, ENROLMENT_ID, KEY_FIELD);
CREATE INDEX DM_DEVICE_INFO_DEVICE_idx ON DM_DEVICE_INFO (DEVICE_ID ASC);
CREATE INDEX DM_DEVICE_INFO_DEVICE_ENROLLMENT_idx ON DM_DEVICE_INFO (ENROLMENT_ID ASC);
@ -678,4 +679,4 @@ WHERE
DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
ORDER BY TENANT_ID, DEVICE_ID;
-- END OF DASHBOARD RELATED VIEWS --
-- END OF DASHBOARD RELATED VIEWS --

Loading…
Cancel
Save