|
|
|
@ -954,19 +954,19 @@ END;
|
|
|
|
|
|
|
|
|
|
-- DM_TAG TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_TAG (
|
|
|
|
|
ID BIGINT IDENTITY(1,1) PRIMARY KEY,
|
|
|
|
|
ID INTEGER IDENTITY(1,1) PRIMARY KEY,
|
|
|
|
|
NAME NVARCHAR(255) NOT NULL,
|
|
|
|
|
DESCRIPTION NVARCHAR(255) NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
|
CONSTRAINT DM_TAG_NAME_TENANT_UNIQUE UNIQUE (NAME, TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
-- END OF DM_TAG TABLE --
|
|
|
|
|
|
|
|
|
|
-- DM_DEVICE_TAG_MAPPING TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TAG_MAPPING (
|
|
|
|
|
ENROLMENT_ID BIGINT NOT NULL,
|
|
|
|
|
TAG_ID BIGINT NOT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
ENROLMENT_ID INTEGER NOT NULL,
|
|
|
|
|
TAG_ID INTEGER NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
|
PRIMARY KEY (ENROLMENT_ID, TAG_ID, TENANT_ID),
|
|
|
|
|
FOREIGN KEY (ENROLMENT_ID) REFERENCES DM_ENROLMENT(ID),
|
|
|
|
|
FOREIGN KEY (TAG_ID) REFERENCES DM_TAG(ID) ON DELETE CASCADE
|
|
|
|
|